## You can use
this command to lock the User: user1.
[root@localhost ~]# passwd -l user1
Locking password for user user1.
passwd: Success
[root@localhost ~]# passwd -l user1
Locking password for user user1.
passwd: Success
## This command shows you particular user status. If it is locked or unlock.
[root@localhost ~]# passwd -S user1
user1 PS 2013-01-21 0 99999 7 -1 (Password set, MD5 crypt.)
## Using this command it will give you list.
[root@localhost
~]# cat /etc/passwd | cut -d : -f 1 | awk '{ system("passwd -S "
$0) }'
test PS 2012-12-27 0 99999 7 -1 (Password set, MD5 crypt.)
user1 PS 2013-01-21 0 99999 7 -1 (Password set, MD5 crypt.)
alka LK 2013-01-21 0 99999 7 -1 (Password locked.)
yo LK 2013-01-21 0 99999 7 -1 (Password locked.)
## Using the -u option you can unlock the user.
[root@localhost
~]# passwd -u user1
Unlocking
password for user user1.
passwd:
Success.
####### Another way to lock/unlock the user is "usermod".
## For Locking user.
[root@localhost ~]#usermod -L username
## for Unlocking the user.
[root@localhost
~]#usermod -U
username
No comments:
Post a Comment