By Stan Hao
i tried to ssh root@ipaddress. I received error port 22 connection refused. Can you help with this?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
resolved. ssh was not installed correctly
apt-get install openssh-server openssh-client
To login via SSH, you’ll need to get your Droplet’s Public IPv4 address from the DigitalOcean Control Panel. You’d then login using either:
ssh root@droplet_ip
or, if you’re using SSH Keys:
ssh root@droplet_ip -i /path/to/private_key
Where /path/to/private_key is the direct path to the private key that’s associated with the public key that should be in ~/.ssh/authorized_keys on your Droplet.
The above works if your on a Mac or Linux box using Terminal or another similar application. If you’re on Windows, you’ll need to use PuTTy or something similar and create a session as PuTTy doesn’t work like a standard Terminal application does (in terms of how you login) – at least not the GUI version.
Hi @stanhao
Have you changed the port of the SSH server? If yes, then you need to change on the client too, meaning connecting with -p like:
ssh -p 22 root@domain_or_ip
Maybe you activated the firewall, but forgot to allow port 22?
This means you’re locked out. You can go to the control panel of DigitalOcean and access your droplets console, where you can allow port 22 thru the firewall with this command:
sudo ufw allow 22
Or you have a IPS like fail2ban, which has blocked you for some reason. Go to the console and restart fail2ban, which normally clears any blocking:
service fail2ban restart
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.