0

I am trying to setup one of my linux computers as an ssh server but I can't connect to it.

I have openssh-server and openssh-client installed already on both computers (client and server).

If I run sudo service ssh start, I get start: Job is already running: ssh, so ssh is indeed running. Also, ps aux | grep -i ssh returns

1000 2270 0.0 0.0 4080 24 ? Ss 06:04 0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session mate-session

1000 2286 0.0 0.3 59104 7832 ? Sl 06:04 0:00 /usr/bin/mate-keyring-daemon --start --components=ssh

1000 6333 0.0 0.0 6684 1132 ? Ss 07:29 0:00 /usr/sbin/sshd

root 12622 0.0 0.1 6684 2432 ? Ss 08:09 0:00 /usr/sbin/sshd -D

1000 13978 0.0 0.0 4392 844 pts/0 S+ 08:33 0:00 grep --color=auto -i ssh

If I run ssh localhost on the server, I can connect. But if I try that with the other computer on the lan, it doesn't work.

I have samba shares setup and working, so I don't think its a firewall problem.

Any help would be appreciated.

4
  • What exact command are you running to connect from the other machine? And what is the output if you append -vvv (very very verbose) to the ssh command on the client? And what do logs on your server say? (/var/log/syslog, /var/log/auth.log) "it doesn't work" is very vague :)
    – gertvdijk
    Feb 9, 2013 at 13:43
  • pastebin.com/CCsMN6dB Feb 9, 2013 at 13:47
  • Why are you connecting to localhost on the client machine? Use the host name or IP address of the target machine (server) you want to connect to!
    – gertvdijk
    Feb 9, 2013 at 13:49
  • just did that and now it works. solved. :) Feb 9, 2013 at 13:52

1 Answer 1

3

Check if ssh is listening at port 0.0.0.0:22/TCP

$ sudo netstat -putan | grep LIST | grep 22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      4330/sshd       
tcp6       0      0 :::22                   :::*                    LISTEN      4330/sshd       

If it is listening, check if you have a firewall:

sudo iptables -L INPUT -n -v

If appears lots of lines, you could have UFW enabled check it using: sudo ufw status

If it is enabled try to add a rule to permit ssh:

 sudo ufw allow ssh

After that try to connect to ssh again. If it doesn't work you can disable the firewall completly with the next line and try again: sudo iptables -F

(note the above line is not permanent, so if you reboot the computer the firewall could start again, disable or configure your firewall correctly)

1
  • It's a nice explanation, but that wasn't what the question is about. As you can read in the comments, the OP was trying to connect from client to client instead of client to server.
    – gertvdijk
    Feb 10, 2013 at 18:20

You must log in to answer this question.

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