Solved

Remove ssh key pair generated - Linux

Posted on 2014-12-01
4
243 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 61

Expert Comment

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

Author Comment

by:carlino70
Comment Utility
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 61

Accepted Solution

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

Author Closing Comment

by:carlino70
Comment Utility
Thanks!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now