I have two computers connected to the same subnet.

The first (A) is running 14.04, the second (B) 12.04

I can ssh from the first to the second, but not from the second to the first.

Don't really know where to start to figure out why there's this difference.

However nmap is giving quite different results:

Computer (A), which is the one I can't get into:

631/tcp open  ipp

Computer (B), which I can get into:

22/tcp  open  ssh
53/tcp  open  domain
139/tcp open  netbios-ssn
445/tcp open  microsoft-ds
631/tcp open  ipp

Since the only port that's open on both is 631, I've tried ssh'ing from B to A specifying port 631, but that doesn't work either.

Could anybody please advise how to proceed?

  • Please edit your question and add more details. How are you connecting? Are you using an IP or a hostname? Can you ping the machine you can't connect to? Try connecting with sshh -vvv user@host and post the output here. – terdon Jun 5 '15 at 16:24

Install openssh server on PC A.

sudo apt-get install openssh-server

More details you have here

Then you will can ssh into PC A from PC B

SSH work on port 22.

Edit 1

If you have installed ssh-server on PC A you can check with command netstat -at do server expect connection on port 22

This is output from my PC

xxx@xxx:~$ netstat -at
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:microsoft-ds          *:*                     LISTEN
tcp        0      0 *:netbios-ssn           *:*                     LISTEN
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 *:ipp                   *:*                     LISTEN
tcp        0      0 *:telnet                *:*                     LISTEN
tcp        0    320 xxxx:ssh              xxx.xxx.xx.xxx:43423    ESTABLISHED
tcp6       0      0 [::]:microsoft-ds       [::]:*                  LISTEN
tcp6       0      0 [::]:netbios-ssn        [::]:*                  LISTEN
tcp6       0      0 [::]:http               [::]:*                  LISTEN
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN
tcp6       0      0 [::]:ipp                [::]:*                  LISTEN
tcp6       1      0 ip6-localhost:38900     ip6-localhost:ipp       CLOSE_WAIT

Important is:

tcp        0      0 *:ssh                   *:*                     LISTEN

If you set ufw or some firewall disable it and try connect then.

Also restart ssh service

sudo service ssh restart

You will see if service start.

  • ssh is installed and is running on both machines, and /etc/ssh/sshd_config on and the /etc/ssh/sshd_config files are identical on both machines. – Leo Simon Jun 5 '15 at 15:40
  • Sorry I forgot to add: the message I receive when I try to log into PC A is "connection refused" – Leo Simon Jun 5 '15 at 16:11
  • I add Edit 1 to answer – 2707974 Jun 5 '15 at 17:33

Thanks very much for your responses. I finally resolved this problem, thanks to the very helpful thread

Bizarre SSH Problem - It won't even start

The problem was that in the version of sshd_server that I downloaded with

apt-get install sshd_server

There were three lines at the bottom of the sshd_config file that was installed, which proved to be the source the problem

Host *
    ForwardAgent yes
    ForwardX11   yes

When I removed these lines my remote login problems were resolved. To diagnose the problem, I followed the suggestion in the above thread, which suggested closing sshd with

service sshd stop

then running in debug mode

/usr/sbin/sshd -p 22 -D -d -e

In debug mode, sshd flagged the bad options in the default sshd_config file.

After removing these lines, and restarting, port 22 was open.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.