Ubuntu – Cannot establish ssh connection to computer on local network

11.10ssh

I've just (re)installed ubuntu 11.10 on my main pc, and the connection times out every time I try to ssh connect to my laptop (over the local network) to retrieve the files I backed up there. The connection times out every time I try to connect.

I can establish a connection in the other direction without issue.

Here's the verbose output I get when I try to connect:

ovangle@ruby-EP43-DS3:~$ ssh -v ovangle@10.1.1.4
OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 10.1.1.4 [10.1.1.4] port 22.
debug1: connect to address 10.1.1.4 port 22: Connection timed out
ssh: connect to host 10.1.1.4 port 22: Connection timed out

ssh is installed on both machines, and I've tried deleting '~/.ssh/known_hosts' on both machines, still nada.

I've changed the sshd logging on the laptop to VERBOSE and restarted the daemon (because I wasn't getting any relevant syslog entries otherwise), and this is the log for the most recent connection attempt.

EDIT: posted wrong logs last time. They just showed that there was a connection received, they weren't actually the sshd logs (which were in auth.log as I recently discovered). Unfortunately, that log is filling up with extremely weird error messages and it gives me no information about the connection.

Nov  8 16:02:18 ovangle-A6Rp pkexec: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
Nov  8 16:02:18 ovangle-A6Rp pkexec: pam_ck_connector(polkit-1:session): cannot determine display-device
Nov  8 16:02:18 ovangle-A6Rp pkexec[6270]: ovangle: Executing command [USER=root] [TTY=unknown] [CWD=/home/ovangle] [COMMAND=/usr/sbin/gnome-power-backlight-helper --set-brightness 2]
Nov  8 16:02:19 ovangle-A6Rp pkexec: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
Nov  8 16:02:19 ovangle-A6Rp pkexec: pam_ck_connector(polkit-1:session): cannot determine display-device
Nov  8 16:02:19 ovangle-A6Rp pkexec[6273]: ovangle: Executing command [USER=root] [TTY=unknown] [CWD=/home/ovangle] [COMMAND=/usr/sbin/gnome-power-backlight-helper --set-brightness 7]

Best Answer

Make sure you install the openssh server in the main PC (where you are trying to ssh into)

sudo apt-get install openssh-server

then check if the Ubuntu firewall is turne on?

sudo ufw status

if yes or no still issue the following command

sudo ufw allow ssh and sudo ufw reload

Now try to ssh using

ssh user@ip-address-of-the-machine

If this doesn't work try to add the INPUT and OUTPUT firewall rule in IPTABLE

sudo iptables -I INPUT -p tcp --dport 22 -j ACCEPT

sudo iptables -I OUTPUT -p tcp --dport 22 -j ACCEPT

sudo iptables-save

sudo service iptables restart

You might have to restart the network manager as well. Good Luck!

Related Question