Written by Guillermo Garron .
Date: 2010-12-06 10:36:30 -0400
If you need to block a user and do not allow him / her to log into your Linux system, maybe because she is a user who stopped working at your organization, or because she was moved to other department, or any other reason.
I’m going to show how to do it temporarily as to do it permanent you just need to erase the user account.
Temporarily lock a user out of a Linux machine We’ll use passwd command, and the syntax is:
passwd -l [user]
So let’s imagine the user’s username is “Jennifer”. The first step is to block the user loggin.
passwd -l jennifer
Next, in case the user has the option to log into the system using ssh keys, you may move her keys to other location.
mv /home/jennifer/.ssh /home/jennifer/temporarily-locked
Once, Jennifer has permission to log into the Linux server again just run:
mv /home/jennifer/temporarily-locked /home/jennifer/.ssh
passwd -u jennifer
She now has the option to log in again.permalink
If you enjoyed the article, please share it
comments powered by Disqus
My name is Guillermo Garron. I am telecommunications engineer from Bolivia
I like technology a lot, and this site is mainly dedicated to that
Posts via email
If you use the letter icon above and subscribe to my tinyletter newsletter, you will get one to two emails, related to this site, or not. If what you want is to get the posts of this site via email, use the form below