Suse & OpenSuse : Tips, Tricks, Tutorials, How Tos and Troubleshooting

How to temporary disable users

From time to time, we will need to disable users.  This may be prior to the permanent deletion of the user account or just as a precautionary step.

As root, you can easily disable a user account by

# usermod –L <username>

Or you can just add an ! in front of the 2nd field (the encrypted password) in the /etc/shadow entry of the user.

To re-enable the user, you can

# usermod –U <username>

This will unlock the user, or simply put, remove the ! in front the password field of /etc/shadow.

If you would like to permanently delete a user, you should use

userdel –r <username>

to also remove their home directories.  Note that in a typical administration, you would usually keep the home directory in case of the need for their data.

RSS feed | Trackback URI

Comments »

No comments yet.

Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.