1. Create a user :
# adduser raj
# grep raj /etc/passwd /etc/shadow
/etc/passwd:raj:x:513:513::/home/raj:/bin/bash
No point looking at /etc/passwd since nothing
changes there
/etc/shadow:raj:!!:13034:0:99999:7:::
2. chage -d 0 raj
The 3rd field of /etc/shadow is :
Days since Jan 1, 1970 that password was last changed
We make it 0, which means the passwd was last changed on
Jan 1, 1970 and hence has expired, so it is promptly locked
with this : --> !!
# grep raj /etc/shadow
/etc/shadow:raj:!!:0:0:99999:7:::
3. Test the password status :
# passwd -S raj
Password locked.
raj cannot log in, yet
4. Unlock the password, forcefully
# passwd -uf raj
Unlocking password for user raj.
passwd: Success.
This changes the !! to a blank which means the password is now unlocked
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment