# ssh localhost and sshd_config listen address

## huuan

In case someone else has this issue. Just spent way too many hours debugging why the sftp plugin for wordpress had stopped working after server upgrade 32bit-->64bit. 

Was getting connection refused. 

Found I could SSH into the box externally but not via localhost even with the firewall disabled.

Tried NMAP from external and I could see the SSH port open but found from localhost it was closed. 

Turns out that it was a weird DNS related problem.

The box in question has a legacy original name like xxtest but is now always referred to like xx. Both xx and xxtest are in DNS but xxtest is the primary name and xx an alias.

In /etc/hosts it had

127.0.0.1 xx.domain.tld xx localhost

Found that NMAP locally to xxtest showed the SSH port open but NMAP locally to xx or localhost showed it closed.

NMAP externally to both xx and xxtest showed the SSH port open. Weird.

The solution was to add the line

ListenAddress 127.0.0.1

to /etc/ssh/sshd_config

had been working on the old system, also gentoo, for years without that line. No clue what changed to cause that.

Hope this helps someone.

----------

