How to lock (disable) and enable user account on Linux

To lock, you can use the follow command:

# passwd -l username (where username is the login id).

This option is used to lock the specified account and it is available to root only. The locking is performed by rendering the encrypted password into an invalid string (by prefixing the encrypted string with an !).

After that, if someone try to loginusing this account, the system will return:
# su – username
This account is currently not available.

To Unlock the same account
Following command re-enables an account by changing the password back to its previous value i.e. to value before using -l option.

# passwd -u username

This removes the ‘!’ in front of the encrypted password

Read more: http://linuxpoison.blogspot.com/2010/07/how-to-lock-unlock-enable-disable-linux.html#ixzz2uDrHPbmD

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s