LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-31-2019, 06:31 PM   #1
mkrco
LQ Newbie
 
Registered: Feb 2019
Posts: 5

Rep: Reputation: Disabled
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.

Any help please?

thank you
 
Old 10-31-2019, 06:50 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
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.
 
Old 10-31-2019, 10:38 PM   #3
mkrco
LQ Newbie
 
Registered: Feb 2019
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
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.

Last edited by mkrco; 10-31-2019 at 10:39 PM.
 
Old 10-31-2019, 10:45 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by mkrco View Post
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.
 
Old 11-01-2019, 01:31 AM   #5
mkrco
LQ Newbie
 
Registered: Feb 2019
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
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.
 
Old 11-01-2019, 01:36 AM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
If they are your own machines, run sshd with the debug option to see how the connection attempts look on the server.
 
Old 11-01-2019, 02:26 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by mkrco View Post
I did rm -rf in my ~/.ssh directory
Was there a config file also?
Is the directory now completely empty?

Quote:
Originally Posted by mkrco View Post
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
Maybe the wrong port?
Some people like to set up different ports than the default 22 for ssh.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Set up rules for proxies to use only for certain destinations (possibly via iptables) swulff Linux - Networking 1 04-09-2014 08:57 PM
Can I Add Destinations in "Copy To" and Move To"? jimwg Linux - Desktop 3 12-06-2012 08:56 AM
[SOLVED] ssh tunnelling to multiple destinations - how to handle changing server key ? kubuntu-man Linux - Networking 7 09-17-2012 09:52 AM
VSFTPD files/folders uploaded by OSX machines can only be deleted by OSX machines anon091 Linux - Server 11 03-16-2012 02:09 PM
Difficulties installing new urpmi destinations iqbala Mandriva 1 10-23-2005 04:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration