17

I used:

usermod -L myUser

to disable the password for this account. Assuming that I don't know the password how do I check that it has been disabled.

According to the man page it places ! in the front of the encrypted password, but I don't know how to check that either.

1 Answer 1

25

You can use the passwd utility to look at the status of the user's password entry

passwd -S user
user LK 2012-11-06 0 99999 7 -1 (Password locked.) (CentOS)
user L 01/22/2013 0 99999 7 -1 (Ubuntu)

The LK as well as the (Password Locked) text indicate a locked password entry on CentOS and L indicates a locked password entry on Ubuntu.

You can also use getent to read the shadow database

getent shadow user
user:!$6$ic7iX.Q2$q9K5gi5pOb...TJlhAIoKVJfAybADtv80:15650:0:99999:7:::

or you can just look at the shadow file yourself

grep user /etc/shadow
user:!$6$ic7iX.Q2$q9K5gi5pOb...TJlhAIoKVJfAybADtv80:15650:0:99999:7:::
2
  • 1
    What does the 'K' mean? No entry in the man page, and it is also not present here: manpages.ubuntu.com/manpages/precise/en/man1/passwd.1.html. I also do not get (Password locked) as indicated (just mentioned as a troubleshoot, it really isn't a problem)
    – DarkSheep
    Commented Feb 11, 2013 at 15:10
  • 1
    Sorry my mistake I was on a CentOS system when I ran the passwd command and it's obviously different from Ubuntu. On Ubuntu the meaning of L is locked, NP means no password and P indicate a usable password. Use the man command on the Ubuntu box - man passwd and look up -S
    – user9517
    Commented Feb 11, 2013 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .