Monday, January 21, 2013

How To Lock/Unlock and Check The User In Linux.

## You can use this command to lock the User: shrii.

[root@localhost ~]# passwd -l shrii
Locking password for user shrii.
passwd: Success

##  This command shows you particular user status. If it is locked or unlock.

[root@localhost ~]# passwd -S shrii
shrii 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.)
shrii PS 2013-01-21 0 99999 7 -1 (Password set, MD5 crypt.)
shrikant 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 shrii
Unlocking password for user shrii.
passwd: Success.

####### Another way to lock/unlock the user is "usermod".

## For Locking user.

usermod -L username

## for Unlocking the user.
usermod -U username


khan mohammad said...

I like the helpful info you provide in your articles. I will bookmark your blog and check again here regularly
Visits My sites>Meditation uk

digital signature software said...

Thanks for a great read. I love it, i love it so much that the greedy gnome in me wants more.

Amar G said...

Iot Training in Bangalore
Machine Learning Training in Bangalore
Pcb Training in Bangalore
Devops Training in Bangalore

meena resma said...

Thanks for sharing this Informative content. Well explained. Got to learn new things from your Blog on. Google cloud computing Online training Hyderabad

Renu said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops Training in electronic city

Ananya Krishnan said...

best devops training institute in Chennai |
DevOps training Center in Chennai |
DevOps training in Chennai Quora

DevOps (AWS) is a dynamic, growing business unit within which organization is moving towards. DevOps is designed to allow application providers, ISVs, and vendors to quickly and securely host your applications. Credo Systemz provides the best DevOps Training to get your certifications easily.