I'm administrating a networked environment where the users authenticate over NIS. All machines can be used to SSH into the server but one. On the machine in question, I get the message
ssh: connect to host servername port 22: Connection refused
I compared strace
outputs from the machine in question and a machine that can SSH into the server correctly.
It turns out the machine that can't SSH into the server doesn't consult /etc/hosts
while the machine that can SSH correctly does. Both machines have /etc/hosts
set up with the server's name and IP. In the end, the machine that doesn't consult /etc/hosts
ends up trying to connect to 127.0.0.1
(localhost) and fails with the above message. What can be causing this?
Additional information:
- The server I'm trying to SSH into also acts as the name server and both machines consult it while trying to SSH into it.
- The machine that can't SSH into the server can SSH correctly into other machines when I do
ssh machinename
Thestrace
logs show that the machine consults the nameserver (this time successfully) and manages to resolve the remote machine name correctly and connect to it.
EDIT: I will gladly provide any additional information that you think might help solve this issue.