On my server, I have several public SSH keys in ~/.ssh/authorized_keys
.
I would like to temporarily block/disallow/deactivate one key. I want to prevent the user to log in using this key now. but I might want to reanable it later (i.e. I don't want to delete the key entirely).
What is the correct/recommended way to do it?
Shall I just put a comment #
at the beginning of the line in authorized_keys
, in front of the key?
To clarify, I don't want to block a specific user. One user account is shared among several people, each person connecting with his own SSH key. I want to block one specific SSH key.
Best Answer
You could prefix the key with a forced command that tells the user what's going on. For example:
Then they get: