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
urjit on railsurjit on rails
1,8934 gold badges20 silver badges39 bronze badges
5
Here are a couple of things that could be preventing you from connecting to tướng your Linode instance:
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.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 bu 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
mfriedmanmfriedman
9221 gold badge9 silver badges13 bronze badges
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:
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.
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 lập cập ssh -p 1234 hostname.
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 vãn 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
Akash SAkash S
2262 silver badges5 bronze badges
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
FurqanFurqan
1412 silver badges7 bronze badges
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
1685155616851556
3514 silver badges12 bronze badges
Just adding this here because it worked for bu. 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
arranjdavisarranjdavis
7359 silver badges19 bronze badges
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.
- Check sudo systemctl status ssh is Active or not.
- 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
GaniGani
4421 gold badge9 silver badges16 bronze badges
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 bu 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 vãn one concurrent connection, it would hốc 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 kết thúc fix was to tướng use ssh user@server-domain
rather than vãn ssh user@public-ip
answered Mar 21, 2021 at 20:01
Jacob WatersJacob Waters
3471 gold badge4 silver badges11 bronze badges
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
sg28sg28
1,38711 silver badges20 bronze badges
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:
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-------).
Nasty docker network configuration. This just happened to tướng bu 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 from192.168.176.1
->192.168.191.254
), whereas the security group had a range of192.168.179.0/24
; interfering with the SSH access.
answered Mar 18, 2022 at 12:46
Andreas ForslöwAndreas Forslöw
2,7182 gold badges29 silver badges40 bronze badges
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:
- 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).
- Port 22 is open or not on the server you are trying to tướng ssh.
- If the control of remote server is in your hands and you have permissions, try to tướng disable firewall on it.
- 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 bu 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
Atul PatelAtul Patel
5834 silver badges11 bronze badges
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
RISHIRISHI
14 bronze badges
This happened to tướng bu 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 bu 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
ShahjahanShahjahan
2393 silver badges3 bronze badges
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 thesudo apt-get install openssh-server
command.Check your virtual machine ssh connection with
sudo service ssh status
at console.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
AdemAdem
611 silver badge5 bronze badges
Reset the firewall and reboot your VPS from your hosting service, it will start working perfectly fine
answered Dec 11, 2022 at 20:37
FurqanFurqan
1412 silver badges7 bronze badges
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