I am trying to tướng connect to tướng remote server via ssh but getting connection timeout.

I ran the following command

ssh [email protected]

and getting following result

ssh: connect to tướng host [email protected] port 22: Connection timed out

but if try to tướng connect on another remote server then I can login successfully.

So I think there is no problem in ssh and other person try to tướng login with same login and password he can successfully login to tướng server.

Please help me
Thanks.

asked Aug 29, 2012 at 6:41

5

Here are a couple of things that could be preventing you from connecting to tướng your Linode instance:

  1. DNS problem: if the computer that you're using to tướng connect to tướng your remote server isn't resolving test.kameronderdehamer.nl properly then you won't be able to tướng reach your host. Try to tướng connect using the public IP address assigned to tướng your Linode and see if it works (e.g. ssh [email protected]). If you can connect using the public IP but not using the hostname that would confirm that you're having some problem with tên miền name resolution.

  2. Network issues: there might be some network issues preventing you from establishing a connection to tướng your server. For example, there may be a misconfigured router in the path between you and your host, or you may be experiencing packet loss. While this is not frequent, it has happenned to tướng bủ several times with Linode and can be very annoying. It could be a good idea to tướng kiểm tra this just in case. You can have a look at Diagnosing network issues with MTR (from the Linode library).

answered Sep 3, 2012 at 21:46

1

That error message means the server to tướng which you are connecting does not reply to tướng SSH connection attempts on port 22. There are three possible reasons for that:

  1. You're not running an SSH server on the machine. You'll need to tướng install it to tướng be able to tướng ssh to tướng it.

  2. You are running an SSH server on that machine, but on a different port. You need to tướng figure out on which port it is running; say it's on port 1234, you then run rẩy ssh -p 1234 hostname.

  3. You are running an SSH server on that machine, and it does use the port on which you are trying to tướng connect, but the machine has a firewall that does not allow you to tướng connect to tướng it. You'll need to tướng figure out how to tướng change the firewall, or maybe you need to tướng ssh from a different host to tướng be allowed in.

EDIT: as (correctly) pointed out in the comments, the third is certainly the case; the other two would result in the server sending a TCP "reset" package back upon the client's connection attempt, resulting in a "connection refused" error message, rather than thở the timeout you're getting. The other two might also be the case, but you need to tướng fix the third first before you can move on.

answered Mar 19, 2020 at 20:42

1

This happens because of firewall connection. Reset your firewall connection from your hosting trang web.

It will start working.

After connecting to tướng the server again add this to tướng your (ufw) security

sudo ufw allow 22/tcp

answered Nov 9, 2022 at 18:50

1

I got this error and found that I don't have my SSH port (non standard number) whitelisted in config server firewall.

Victor2748

4,19913 gold badges55 silver badges94 bronze badges

answered Nov 13, năm trước at 0:08

Just adding this here because it worked for bủ. Without changing any settings (to my knowledge), I was no longer able to tướng access my AWS EC2 instance with: ssh -i /path/to/key/key_name.pem [email protected]

It turned out I needed to tướng add a rule for inbound SSH traffic, as explained here by AWS. For Port range 22, I added 0.0.0.0/0, which allows all IPv4 addresses to tướng access the instance using SSH.

Note that making the instance accessible to tướng all IPv4 addresses is a security risk; it is acceptable for a short time in a test environment, but you'll likely need a longer term solution.

answered Nov 22, 2021 at 7:58

If you are on Public Network, Firewall will block all incoming connections by mặc định. kiểm tra your firewall settings or use private network to tướng SSL

answered Oct 22, 2018 at 12:36

The possibility could be, the SSH might not be enabled on your server/system.

  1. Check sudo systemctl status ssh is Active or not.
  2. If it's not active, try installing with the help of these commands

sudo apt update

sudo apt install openssh-server

Now try to tướng access the server/system with following command

ssh username@ip_address

answered Jan 29, 2019 at 7:52

Try connecting to tướng a vpn, if possible. That was the reason I was facing problem. Tip: if you're using an ec2 machine, try rebooting it. This worked for bủ the other day :)

answered Jan 13, 2021 at 5:46

I had this issue while trying to tướng ssh into a local nextcloud server from my Mac.

I had no issues ssh-ing in once, but if I tried to tướng have more than thở one concurrent connection, it would lỗ until it timed out.

Note, I was sshing to tướng my user@public-ip-address.

I realized the second connection only didn't work when I tried to tướng ssh into it when on the same network, ie my trang chính network

Furthermore, when I tried ssh user@server-domain it worked!

The over fix was to tướng use ssh user@server-domain rather than thở ssh user@public-ip

answered Mar 21, 2021 at 20:01

This may be very case specific and work in some cases only but check to tướng see if you were previously connecting through some VPN software/application.

Try connecting again to tướng the VPN. Worked in my case.

answered Nov 11, 2021 at 9:49

There can be many possible reasons for this failure.

Some are listed above. I faced the same issue, it is very hard to tướng find the root cause of the failure.

I will recommend you to tướng kiểm tra the session timeout for shh from ssh_config tệp tin. Try to tướng increase the session timeout and see if it fails again

answered Oct 27, năm 2016 at 12:58

My VPN connection was not enabled. I was trying all possible way to tướng open up the Firwall and Ports until I realized, I am working from trang chính and my VPN connection was down. But yes, Firewall and ssh configurations can be a reason.

answered May 8, 2020 at 7:10

I have experienced a couple of nasty issues that lead to tướng these errors, and these are different from everyone else's answer here:

  1. Wrong thư mục access rights. You need to tướng have specific directory permissions on you ssh folders and files. a. The .ssh directory permissions should be 700 (drwx------).

    b. The public key (.pub file) should be 644 (-rw-r--r--).

    c. The private key (id_rsa) on the client host, and the authorized_keys tệp tin on the server, should be 600 (-rw-------).

  2. Nasty docker network configuration. This just happened to tướng bủ on an AWS EC2 instance. It turned out that I had a docker network with an ip range that interfered with the ssh access granted by the security group and VPC. The docker network's range was e.g. 192.168.176.0/20 (i.e. a range from 192.168.176.1->192.168.191.254), whereas the security group had a range of 192.168.179.0/24; interfering with the SSH access.

answered Mar 18, 2022 at 12:46

I had this error when trying to tướng SSH into my Raspberry pi from my MBP via bash terminal. My RPI was connected to tướng the network via wifi/wlan0 and this IP had been changed upon restart by my routers DHCP.

Check IP being used to tướng login via SSH is correct. Re-check IP of device being SSH'd into (in my case the RPI), which can be checked using hostname -I

Confirm/amend SSH login credentials on "guest" device (in my case the MBP) and it worked fine in my attempt.

answered Mar 28, 2020 at 20:34

I faced a similar issue. I checked for the below:

  1. if ssh is not installed on your machine, you will have to tướng install it firstly. (You will get a message saying ssh is not recognized as a command).
  2. Port 22 is open or not on the server you are trying to tướng ssh.
  3. If the control of remote server is in your hands and you have permissions, try to tướng disable firewall on it.
  4. Try to tướng ssh again.

If port is not an issue then you would have to tướng kiểm tra for firewall settings as it is the one that is blocking your connection.

For bủ too it was a firewall issue between my machine and remote server.I disabled the firewall on the remote server and I was able to tướng make a connection using ssh.

answered Jul 3, 2020 at 8:32

my main machine is windows 10 and I have CEntOS 7 VBox
Search in your main machine for "known_hosts"
usually, known_host location in windows in "user/.ssh/known_host"
open it using notepad and delete the line where your centos vbox ip
then try connect in your terminal

in mac os user you can find known_hosts in "~/.ssh/known_hosts"

answered Jul 17, 2021 at 3:57

This issue is also caused if the Dynamic Host Configuration Protocol is not set-up properly.

To solve this first kiểm tra if your IP Address is configured using ping ipaddress, If there is no packet loss and the IP Address is working fine try any other solution. If there is no response and you have 100% packet loss, it means that your IP Address is not working and not configured.

Now configure your IP Address using,

sudo dhclient -v devicename

To kiểm tra your device you can use the 'ip a' command For eg. My device was usb0 since I had connected the device through usb

This will configure an IP Address automatically and you can even see which one is configured. You can again kiểm tra with the 'ip a' command to tướng confirm.

Dharman

33.1k27 gold badges99 silver badges146 bronze badges

answered Nov 6, 2021 at 21:17

This happened to tướng bủ after enabling port 22 with "sudo ufw allow ssh". Before that, I was getting a refusal from my machine when entering with ssh from another one. After enabling it, I thought it would work, but instead it showed the message "connection timed out". As I had just installed Ubuntu with the option of installing basic functions alongside, I checked whether I had the openssh-server with the command sudo apt list --installed | grep openssh-server. It turned out that Ubuntu had installed by defect the openssh-client instead. I uninstalled it and installed the openssh-server following the basic commands:

sudo apt-get purge openssh-client sudo apt update sudo apt install openssh-server

After that, a simple "sudo ufw allow ssh" worked perfectly and I was finally able to tướng access the machine with an ssh command.

answered Nov 16, 2021 at 13:42

What worked for bủ was that i went to tướng my security group and reset my IP and it worked

answered May 15, 2022 at 22:22

Here are some considerations which i took to tướng resolve a similar issue that I had:

  • Port 22
  • IGW (Internet Gateway)
  • VPC

Scene 1> This is for port 22 not enabled with right configurations. If the port is mix to tướng custom or myip, the probable scene is this won't work.

Scene 2> When you delete the mạng internet gateway, the network is created and the instance will be functional too, but the routing from the mạng internet will not work. Hence make sure that if there is a VPC, it has an Internet Gateway attached.

Scene 3> Check the VPC for the subnet associations and routing table entries. This might probably tell you the cause. I found one in this kind of troubleshooting. The route used to tướng land up in a "blackhole" (shows up in the route table section of the console). To fix this I had to tướng kiểm tra and find out my mạng internet gateway and found the issue with the IGW.

Moral of the story: always trace backward in the network!

answered Jul 23, 2022 at 10:18

In my case I'm on windows, I reset my firewall settings, and it fixed

answered Oct 9, 2022 at 15:18

  1. If you get any error kiểm tra the basic a version control request with ssh -V and If it is not installed, install it with the sudo apt-get install openssh-server command.

  2. Check your virtual machine ssh connection with sudo service ssh status at console.

  3. Check "Active" rows and if write a inactive(dead) the console write sudo service ssh start

Result: Now you can kiểm tra your connection with sudo service ssh status command and send ssh connection request.

answered Oct 17, 2022 at 20:35

Reset the firewall and reboot your VPS from your hosting service, it will start working perfectly fine

answered Dec 11, 2022 at 20:37

check whether accidentally you have deleted the mặc định vpc or mặc định subnets ,while creating your own vpc and subnets. I have done this mistake while creating vpc, hence got this error while connecting via ssh.

alos kiểm tra whether u have attched IGW to tướng public subnets.

answered Mar 12, 2021 at 10:53

2

Its not complicated. First, go disable your firewall(USE YOUR CONTROL PANEL)after you kiểm tra if your openssh is active.

Disable firewall, then use putty or any alternative to tướng basically disable using this command sudo ufw disable

try now

answered Dec 12, 2022 at 11:49

1

Update the security group of that instance. Your local IP must have updated. Every time it’s IP flips. You will have to tướng go update the Security group.

answered Oct 17, 2020 at 14:59

1