3

For a week, SSH was working perfectly. Today I restarted my server and I got this error in my Mac terminal:

ssh: connect to host 162.243.7.7 port 22: Connection refused

This is very odd...

I am not sure if I installed anything yesterday that would interfere with port 22. I installed vsftpd, but that uses port 21.

I ran the command ssh -vvv [email protected] in the terminal to get more information. Here are my results:

OpenSSH_6.9p1, LibreSSL 2.1.7
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 162.243.7.7 [162.243.7.7] port 22.
debug1: connect to address 162.243.7.7 port 22: Connection refused
ssh: connect to host 162.243.7.7 port 22: Connection refused

Next, I went to my actual server and typed service sshd status and got this(sorry that I couldn't get this in text. DigitalOcean doesn't let me copy from their terminal):

The status of SSHD

Here is part of what journalctl -u sshd.service outputs:

journalctl -u sshd.service

Anyone know what is happening? My config file didn't change at all. This is a bit frustrating.

6
  • what is in server log (/var/log/secure)?
    – Jakuje
    Nov 15, 2015 at 18:56
  • Where should I look in the file? It is huge. I'm not quite sure if that file records connection attempts that result in "Connection refused"; If so, I didn't see anything when I tailed it.
    – Doug Beney
    Nov 15, 2015 at 19:09
  • I would open it in a viewer, go to the end of the file, and search backwards for "ssh". Like this: less -i /var/log/secure, hit G to go to the end of the file, type ?ssh<enter>, hit n to repeat search, until you see something interesting or not.
    – RobertL
    Nov 15, 2015 at 19:43
  • Weird. I can't find anything passed November 8th using the less command. Didn't really see anything weird while searching for 'ssh' either.
    – Doug Beney
    Nov 15, 2015 at 19:55
  • Anything interesting in journalctl -u sshd.service?
    – Jeff Schaller
    Nov 15, 2015 at 20:16

2 Answers 2

3

Server log says

sshd: /etc/ssh/sshd_config: No such file or directory

This means the the server is unable to open the file for some reason. Check if the file exists and if it has appropriate permissions (including SELinux labels)

ls -lZ /etc/ssh/sshd_config

should give you enough information to figure this out (restorecon /etc/ssh/sshd_config should fix SELinux label, if it is wrong).

0

It's because of ip conflict, I have same kind of issue, you should not use the same ip for other vm's. Even if you delete it, ip won't be released. try with another ip in the same network it should work.

You must log in to answer this question.

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