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

11 comments:

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.

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

Unknown 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.

prabha krishna said...

Awesome! Education is the extreme motivation that open the new doors of data and material. So we always need to study around the things and the new part of educations with that we are not mindful.
DevOps Training in chennai

DevOps Training in Bangalore

AWS Online Training said...

it's very interesting Blog, thanks for sharing!!
Amazon Web Services Online Training

Shri Priya said...

Thanks for Sharing such a good blog. You’re doing a great job. Keep posting like this useful info !!

  Best Ethical Hacking Training in Chennai    |        Best Ethical Hacking Course in Chennai       |       Ethical Hacking Training with Placement     |     ceh Training in Chennai at TwinTech Solutions     |     Ethical Hacking Course    |            ceh Training      |      Ethical Hacking Training    

E- learning DevOps said...

Thanks for this amazing post! Thank you so much for sharing the good post, I appreciate your hard work.Keep blogging.
DevOps Online Training in Hyderabad
DevOps Training Online
DevOps Training institute in Ameerpet

Alfred Avina said...

The article is so appealing. You should read this article before choosing the Big data cloud solutions you want to learn.

Prwatech said...
This comment has been removed by the author.
Prwatech said...

Wow Very Nice Post I really like This Post. Please share more post.
Data Science Training In Bangalore

Training Institute in Chennai said...

Excellent Post on AWS.
AWS Training in Chennai | AWS Training Institute in Chennai