Cannot ssh to machines I've previously connected to, can only ssh to new destinations
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Cannot ssh to machines I've previously connected to, can only ssh to new destinations
I used to have a public and private rsa key in my ~/.ssh directory which I needed to connect to one particular ssh server for work. Eventually, I no longer needed to connect to that cluster, so I did rm -rf in my ~/.ssh directory (big mistake apparently, I should've known!).
Now, any time I try using ssh to connect to ANY servers I've connected to in the past, I can't.. The shh command in the terminal just freezes forever.
I can connect to new ssh servers (ip addresses I've never connected to before) without a problem.
The lack of a private key should not lead to a hang. ssh should fall back to password authentication, and if the remote system doesn't offer this option, ssh should print an error message and stop.
Add verbosity to the command to see at what point it hangs:
Code:
ssh -vvv REMOTESERVER
EDIT: Rather than troubleshooting the problem, is it an option to generate a new keypair and ask somebody else to install the public key on the remote servers?
Also, you may have a backup somewhere.
Last edited by berndbausch; 10-31-2019 at 06:55 PM.
The lack of a private key should not lead to a hang. ssh should fall back to password authentication, and if the remote system doesn't offer this option, ssh should print an error message and stop.
Add verbosity to the command to see at what point it hangs:
Code:
ssh -vvv REMOTESERVER
EDIT: Rather than troubleshooting the problem, is it an option to generate a new keypair and ask somebody else to install the public key on the remote servers?
Also, you may have a backup somewhere.
Thank you the reply,
The remote server doesn't exist any more (hence why I wiped the key). The problem is I now can't log into ANYTHING that I logged into while I had the key. This includes machines where I never need the key in the first place. New servers are not a problem. I don't have a backup
When using ssh -vvv I get the following (where I've replaced the ip with x's)
ssh -vvv xxx.xxx.xxx.xxx
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "xxx.xxx.xxx.xxx" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
If it hangs there, my guess is that the remote party has no SSH server running or, more likely, that there is no connectivity to the remote party at all. In any case, you don't even get a connection established. This has nothing to do with your keys; keys come into play when there is a connection.
To check IP connectivity, you can try ping. Be aware that the other side might by up and running but ignoring pings; a failed ping is not much of a proof.
Can you talk to whoever is responsible for running those servers? The problem is at their end, I would say.
If it hangs there, my guess is that the remote party has no SSH server running or, more likely, that there is no connectivity to the remote party at all. In any case, you don't even get a connection established. This has nothing to do with your keys; keys come into play when there is a connection.
To check IP connectivity, you can try ping. Be aware that the other side might by up and running but ignoring pings; a failed ping is not much of a proof.
Can you talk to whoever is responsible for running those servers? The problem is at their end, I would say.
I can connect to those servers using a different machine no problem. I don't think the problem is on their end. Some of the machines that I'm trying to connect to are in fact my own machines. They have ssh running, and I can connect to them using different machines.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.