Issue
I recently started with Keypairs to login to SSH, my knowledge here and with SSH in general is very slim, so my apologies if this is shown in my question, or it makes it tricker to answer.
I'm trying to check what public keypairs are on my CentOS7 servers, and then remove all that are not mine. I'm concerned as i have in the past provided access to my servers to people who no longer need it (root access) when they had that access, they could have made a keypair and uploaded it to the server and therefore still able to access the server despite myself changing the root password.
How would i check if any other public keys exist (other than mine) on the server, and then remove it to stop them logging in and therefore ensure security of the server?
Thank you!
Solution
The keypairs are only used for specific users and so are normally kept in the home directory at .ssh/
. They aren't kept in any kind of centralized place other than home directories as far as I know.
If you want to be really careful you can find directories that match .ssh
on the system or id_rsa
.
find / -type d -name .ssh
find / -type f -name '*id_rsa*'
Answered By - MrJLP Answer Checked By - Cary Denson (WPSolving Admin)