Solved

Remove ssh key pair generated - Linux

Posted on 2014-12-01
4
250 Views
Last Modified: 2014-12-10
Hi experts, I made a setup ssh key-pairs between two servers.
It worked well, but now I want to delete it.
The problem is that as it is now prompted for authentication locally to the application when trying to run a script for it. For example to run a stop_app, asks me to enter the user password ( should not ).
Here are the steps I did:
server_1:/home/user/> ssh-keygen -t rsa

Open in new window

I not joined the "passphrase" twice, then 2 files were generated:
id_dsa
id_dsa.pub

Open in new window

I copied id_dsa_pub to the server_2:
server_1:/home/user/scp id_rsa.pub user@server_2:/home/user/.ssh/

Open in new window

Prior backup, renamed it id_rsa.pub:
server_2:/home/user/cp -p authorized_keys authorized_keys_bkp
server_2:/home/user/mv id_rsa.pub authorized_keys

Open in new window

I grant permission to the new file:
server_2:/home/user/chmod 644 authorized_keys

Open in new window

To try to remove the entries, I tried on both servers:
ssh-keygen -R hostname

Open in new window

without positive results.
Then, when I returned to the previous file, "autorized_keys", I try:
server_1:/home/user/>ssh user@server_2:/home/user

Open in new window

I see the message:
ssh server_2:/home/user: Temporary failure in name resolution

Open in new window

I did not make a backup of known_hosts.
What are the correct steps to roll back the configuration?
Tkankyou in advanced, regards.
0
Comment
Question by:carlino70
  • 2
  • 2
4 Comments
 
LVL 62

Expert Comment

by:gheist
ID: 40474261
It is a problem with DNS server or DNS records, nothing to do with authorized keys files.
0
 

Author Comment

by:carlino70
ID: 40482636
I had to regenerate the keys, using a resident script in my /home, which updates the authorized_keys and known_hosts files. It is based on the list of users and network nodes.
This for all users.
With this I could solve the problem.
0
 
LVL 62

Accepted Solution

by:
gheist earned 500 total points
ID: 40483043
sssh-keygen 4096
cat .ssh/id_rsa.pub | ssh user@host tee ~/.ssh/authorized_keys
0
 

Author Closing Comment

by:carlino70
ID: 40492175
Thanks!
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
linux installs 6 60
Python variable _ manually assigned 9 86
awk sed 8 46
error while installing php56 in redhat enterprise linux 20 26
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question