RHEL 6.8, i have a user locally authenticated and not entirely certain if that user has setup key based logins already from another node to connect to the node in question.
I’m thinking of regenerating the ssh keys for the user in order to prevent him from logging in using the previously setup keys.
I have “root” access to the node. What’s the best way forward to restrict the key based login that would have been set but to keep the same account for other services which we currently use the account for.
The list of keys that a user can use to log in to any particular node is stored in
$HOME/.ssh/authorized_keys on the node being logged into. The private key that the user uses to make connections is stored in the node which originates the connection.
If you want to prevent a user logging in using a particular key, you can simply remove it from their
authorized_keys file. But be aware that the user can always put it back themselves, if they can log in to that node or otherwise access that file.
As for determining how a user authenticated, that information is in your log file
/var/log/secure. For example:
# grep Accepted /var/log/secure Nov 26 03:13:46 www sshd: Accepted password for user1 from 203.0.113.242 port 3481 ssh2 Nov 26 03:20:22 www sshd: Accepted publickey for dev2 from 198.51.100.21 port 64386 ssh2: RSA SHA256:...omitted...
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.