Solved

Remove ssh key pair generated - Linux

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

910 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

16 Experts available now in Live!

Get 1:1 Help Now