0

Ubuntu server 20.04 installed and configured to listen to port 2222. From a windows10 machine on the same network I can ssh into the server without difficulty using:

ssh -p 2222 [email protected]

When I try the same from a separate machine (still on the same network) running Ubuntu 18.04 the connection times out.

From the Ubuntu machine I can successfully ping the server.

Any and all suggestions greatly appreciated.

Edit: After entering ssh -p 2222 [email protected] -v from the client, the following displays:

OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.1.207 [192.168.1.207] port 2222.

At this point the server "hangs", that is, nothing else appears on the terminal screen. I hit control_c to get the cursor back. So if I use -vvv, the output is:

ssh -p 2222 [email protected] -vvv
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "192.168.1.207" port 2222
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 192.168.1.207 [192.168.1.207] port 2222.
debug1: connect to address 192.168.1.207 port 2222: Connection timed out
ssh: connect to host 192.168.1.207 port 2222: Connection timed out

The command ip addr on the client machine produces several lines of output, one of which is:

inet 192.168.1.192/24 brd 192.168.1.255 scope global dynamic noprefixroute enp7s0

so I'm on the same 192.168.1.* subnet as the server.

Hope this helps.

line 19 in /etc/ssh/ssh_config (on the client machine) is:

    Host *

followed by a list of 20+ comments. Is "Host" the open_ssh client or server? And how to tailor these choices? Maddening because the windows10 box connects without any problems.

If I've changed the port number (in /etc/ssh/sshd_config) is it also necessary to use port forwarding in the router that provides the network all of these computers are on?

Changed listen port on server back to 22 (commented out the line in /etc/ssh/ssh_config) and now Ubuntu desktop successfully logs into server. Also Windows 10 machine. So if, on the server, I wish to change the port number for ssh connections I'll have to somehow change a config file on the desktop. Any and all suggestions greatly appreciated.

3
  • Check whether you've set any restrictions for who can connect, for example with AllowUsers and/or AllowGroups in the servers sshd_config. Mar 12, 2021 at 12:55
  • Check ip addr on the 18.04 machine. Ensure you are REALLY on the same 192.168.1.* subnet (and not a completely different subnet that happens to also use 192.168.1.*. connection-timed-out is a network error (cannot find the server), not an authentication error.
    – user535733
    Mar 12, 2021 at 15:05
  • Alternately, show us the complete debug output. The first four lines are insufficient.
    – user535733
    Mar 12, 2021 at 15:11

1 Answer 1

0

Check the firewall settings on that machine from which you can't connect. You may find that that port is closed.

See also UFW OpenSSH application port change?

If that doesn't work, use ssh -v to get more verbose output.

2
  • O. K. sudo ufw allow 2222/tcp successfully implemented, but still cannot ssh into server (from Ubuntu 18.04 desktop).
    – Henry Hall
    Mar 12, 2021 at 12:55
  • Answer edited: Use ssh -v to see more verbose messages.
    – HuHa
    Mar 12, 2021 at 13:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .