Question

Suddenly I can't enter in server with ssh in terminal, I am getting Connection timed out. How can I solve this?

ssh root@2**.1**.1**.1** ssh: connect to host 2**.1**.1**.1** port 22: Connection timed out


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
April 7, 2024

Hi there,

Have you tried accessing the server via the web console?

https://docs.digitalocean.com/products/droplets/how-to/connect-with-console/

If the server has a firewall enabled, it must be configured to allow SSH connections. You can check this by accessing the server’s firewall settings and ensuring that inbound connections on port 22 are allowed.

If you don’t have a firewall and the web console also does not work, you can try rebooting the server and also using the recovery console:

https://docs.digitalocean.com/products/droplets/how-to/recovery/recovery-console/

Let me know how it goes!

Best,

Bobby

KFSys
Site Moderator
Site Moderator badge
April 7, 2024

Heya @biprajitkarmakar,

Make sure your Droplet is running, try to ping your Droplet’s IP address. If it doesn’t time out then you can use the DigitalOcean Recovery or Web Console to enter:

Web Console: https://docs.digitalocean.com/products/droplets/how-to/connect-with-console/

Recovery Console: https://docs.digitalocean.com/products/droplets/how-to/recovery/recovery-console/

Once inside you should be able to troubleshoot further. One reasone could be that you don’t have enough space on your Droplet or your firewall is blocking port 22.

IF your droplet doesn’t ping, try to reboot it and see if that helps. If it doesn’t it’s best to contact DigitalOcean’s support

https://www.digitalocean.com/support/

Hope that helps! - KFSys.

Hello, @biprajitkarmakar

Experiencing a “Connection timed out” error when trying to SSH into your server can be due to various reasons, such as network issues, incorrect SSH command syntax, server configuration, or firewall settings. Here are some steps you can take to troubleshoot and resolve the issue:

  • Check Network Connection: Ensure that your local machine has a stable internet connection and can reach the server’s IP address.
  • Verify Server Status: Make sure that the server is up and running. If possible, check the server’s status from a different network or machine.
  • Confirm SSH Service: Ensure that the SSH service is running on the server and listening on the correct port (default is 22).
  • Check Firewall Settings: Verify that your firewall and the server’s firewall are configured to allow SSH traffic on port 22.
  • Use Verbose Mode: Run the SSH command with the -vvv option to get more detailed output, which can help identify where the connection is failing.
  • Increase Timeout: You can increase the timeout value in your SSH client settings to see if it resolves the issue.
  • Check SSH Configuration: Ensure that the SSH configuration on the server is correct and hasn’t been changed recently.

Here’s an example of using the verbose mode to get more information:

ssh -vvv root@2**.1**.1**.1**

I hope my suggestion is helpful for you.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.