Portal Home > Knowledgebase > Articles Database > How to list and remove SSH keys
How to list and remove SSH keys
Posted by sallyanne, 09-29-2009, 03:40 AM |
I'm running Redhat and want to know how I can list and remove any SSH keys which might be installed. Can anyone provide some input? Thanks so much.
|
Posted by AttackerNET, 09-29-2009, 03:46 AM |
Hello Sally,
Do you have a control panel? cPanel/WHM? if so, There is an option to manage SSH keys.
Instead, Edit your /root/.ssh/authorized_keys with an editor such as vi or nano, add/remove keys there and save it. You will need to check your /etc/ssh/sshd_config too, make sure to uncomment " AuthorizedKeysFile .ssh/authorized_keys" or just add it to the file then restart SSHD and you are done.
* If you want to prevent SSH keys connections, make sure to comment out AuthorizedKeysFile line and restart sshd.
Regards,
Last edited by AttackerNET; 09-29-2009 at 03:51 AM.
|
Posted by sallyanne, 09-29-2009, 03:48 AM |
Redhat Enterprise 5 and Plesk
|
Posted by AttackerNET, 09-29-2009, 03:54 AM |
Yes, Sorry I've noticed you already mentioned it in your initial post and I've edited mine, Please follow the instructions and let us know if you need anything else.
Thanks
|
Posted by sallyanne, 09-29-2009, 04:07 AM |
In the /root/.ssh/authorised_keys file there is text like
ssh-rsa AASDB3NzaC93dmx2fkdsidkmw3icsds etc
Should I delete all the text in that file so it is blank?
Thanks for your help.
|
Posted by AttackerNET, 09-29-2009, 04:16 AM |
Yes, This is the key. Remove it or just empty the file by running:
echo > /root/.ssh/authorised_keys
Also it would be better if you comment out AuthorizedKeys in /etc/ssh/sshd_config
You are welcome.
Thanks
|
Posted by sallyanne, 09-29-2009, 04:21 AM |
Thank you, I don't want to stop the SSH key feature completely, I still want to be able to add in a new key, so I don't have to comment out AuthorizedKeys in /etc/ssh/sshd_config do I?
Thanks again. You're a star!
|
Posted by AttackerNET, 09-29-2009, 04:27 AM |
Yes, In this case you don't have to comment it . Thank you
|
Add to Favourites Print this Article
Also Read