How to remove old SSH key from server trusted keys

Hey I am changing my SSH key.

How do I remove my old SSH key from my servers trusted keys.
burnedfacelessAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
You edit it out from ~/.ssh/authorized_keys*

Usually, the key resides in the above file on the user account to which you connect.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pallavi GodseSr. Digital Marketing ExecutiveCommented:
If you want to remove all hosts with known keys -
just remove file ~/.ssh/known_hosts

If you do not want to delete all the hosts in ~/.ssh/known_hosts, then simply:

ssh-keygen -R hostname

Open in new window


Where hostname is the one you wish to remove.

You will get the following warning -

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
f2:92:1d:da:81:2a:d7:16:0a:48:f0:43:20:1c:f4:b5.
Please contact your system administrator.
Add correct host key in /home/novak/.ssh/known_hosts to get rid of this message.
Offending key in /home/novak/.ssh/known_hosts:1

If you see this, confirm the server host key has changed before you simply delete the key from known_hosts, otherwise you may not be connecting to the server you think you are
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Security

From novice to tech pro — start learning today.