Thursday, May 03, 2007

chage: can't lock shadow password file

i got this error "chage: can't lock shadow password file" when executing below command:
# chage -E 2008-04-28 username
google said that this error because of these 2 files exist /etc/passwd.lock or /etc/shadow.lock. they are created when a user is made with useradd command. they contain the PID of the command creating them (useradd). once the PID is gone (useradd exits) the locks no longer apply and should probably have been removed by the process that created them.

in the other word, if you remove these files, you should be able to use back the chage command above. but in my case it's still failed!

turn out that the server just rebooted & one of the start up script is hanging. the script is to start an application & need to su to one user & turn out that the user's password has expired! (got this when try to su to the user - "You are required to change your password immediately (password aged)" & hang there!)

the hanging script!
root 31001 31000 0 May02 ? 00:00:00 /bin/sh /etc/rc3.d/S99apps start
root 31002 31001 0 May02 ? 00:00:00 su - user -c /apps/startapps
killed those processes & settled! :)

p/s: changing a users passwd or locking/unlocking an account does not change, create, or remove these files.


CT said...

CT nie...(OSCC). Mcmana nak contact u ek? e-mail add? Nak minta pendpt lah...TQ

ashterix said...

email me at

Anonymous said...

You solve my problem!! Thanks!!