SOHO : Small Office Home Office
Freeware - Opensource software tips, tricks, tweaks & fixes for managing, securing, improving the performance of SOHO Desktop, Laptop, Networks

Saturday, June 4, 2011

How to enable and disable user accounts in linux?

This will be useful in a situation where you don’t want to permanently remove the user from the system, but just want it disabled so that the user is no longer able to use the system. The user will still receive emails for example, but he will not be able to login and check them out.

The command to "lock (disable) a user account" is
# passwd -l username
With the above command the user account is locked and is available only to root. The locking is performed by rendering the encrypted password into an invalid string by prefixing the encrypted string with an !

The command to "unlock (enable) a user account" is
# passwd -u username
When a user tries to access an locked account, the system will return:
# su - usernameThis account is currently not available.

No comments:

Post a Comment