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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
resolved. ssh was not installed correctly
apt-get install openssh-server openssh-client
@stanhao
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:
or, if you’re using SSH Keys:
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