One my user leaves the office and I’d like to disable her access to our UNIX / Linux system. How do I delete ssh key from the UNIX systems so that user can not log in?
The first step is to disable user login using command as follows:
Linux Lock An Account
# passwd -l userName
# passwd -l vivek
FreeBSD Local An Account
# pw lock userName
# pw local vivek
Solaris / HP-UX UNIX Lock An Account
Remove SSH Keys
$HOME/.ssh/ stores all required keys. Simply rename the directory or delete the directory:
# mv /home/vivek/.ssh /home/vivek/nosshlogin
# rm -rf /home/vivek/.ssh
For remote server edit $HOME/.ssh/authorized_keys or $HOME/.ssh/authorized_keys2 file and remove public key. This will delete login from home computer into your server. Finally, you can always delete user from your system using the pw (FreeBSD) or userdel (Linux / UNIX) command.