Can't connect via SSH

December 18, 2013 19.3k views
I trying connect to my droplet, but putty say "Network error: Connection refused". I can connect to droplet only using Console Access. SFTP not working too.
1 comment
  • i had the same problem but if you are runing UFW you have just to stop it or allow ssh access.
    you just have to login in your droplet and use ssh access to desable the firewale or to allow _ssh acess.

14 Answers
Try running these commands and then start ssh (service ssh start):
rm /etc/ssh/ssh_host_*

/usr/sbin/dpkg-reconfigure openssh-server
Did you edit /etc/ssh/sshd_config?
Is OpenSSH running?
sudo ps wwaux | grep ssh
I think no:
I trying:
No. Today I had rebuild my droplet (Ubuntu 12.04 x32)- installed LAMP, created user, edited apache config. Few hours ago I opened and connected to droplet using putty and tried connect to droplet via SFTP (FileZilla). FilleZillla say "Network error: Connection refused" and I closed and open putty and he also say "Network error: Connection refused".
Hmm. I believe openssh logs to syslog, check if there are any errors:
sudo tail -30 /var/log/syslog

sudo tail -30 /var/log/auth.log
So you have not edited anything in /etc/ssh/sshd_config? What do you have listed in the AllowUsers directive? Is the username listed, that you're attempting to log in with?
I did not open this directory never. I connect only as root
Is there a firewall running? What's the output of
sudo iptables -L -n -v

Add server ip address to /etc/hosts

vi /etc/ssh/sshd_config

PermitRootLogin yes
PasswordAuthentication yes
AllowUsers user_a user_b user_c
systemctl reload sshd
Have another answer? Share your knowledge.