Solved

Remove ssh key pair generated - Linux

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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). …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

828 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