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.

alexdo
Site Moderator
Site Moderator badge
April 10, 2024

Heya,

A timeout can occur and does not mean that an issue has ocurred. Sometimes ssh-clients have session timeouts that can happen if inactivity occurs for some time.

You can ensure that the droplet is online and determine if the issue is within the ssh-client or with the droplet itself.

You can always use the recovery console if normal ssh access is unavailable. The console can be used in emergency cases to regain access to your droplet.

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

Hope that this helps!

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.

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.

Try DigitalOcean for free

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

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

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

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel