Easiest way to lock or unlock the user account in Linux


We traditionally use to lock an user account in Linux by doing “username:x:Pr.Group:Sec.Group ::/home/username: /sbin/nologin” in /etc/passwd file.

There is an easy way to lock and unlock the user account in Linux. The syntax given below

#passwd –l username —à to lock the account

#passwd –u username —à to unlock the account

To know the passwd creation date for the users

# passwd -S -a; this will list the dates along with users when the password was created.

For more interesting info about passwd # man passwd

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

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

%d bloggers like this: