Daily Log: remove user password in linux/for change password

Q. How do I delete user Password and for user under Linux?

A. All user encrypted passwords are stored in /etc/shadow file. The quick way to remove/delete a user password is pass –delete option to passwd command.

First, login in as a root user. Command to delete user password under Linux

Type the following command to delete a user password:

# passwd --delete username

OR

# passwd -d username

Above command delete a user’s password (make it empty). This is a quick way to disable a password for an account. It will set the named account passwordless. User will not able to login. but if the user still have his/her ssh public keys he/she can still login to the accounts to disable the account permanently do:

# usermod -s /sbin/nologin username

NOTE: this also useful to force user to change their password at login (those that have ssh public keys auth enabled) with chage command combined, example

# passwd -d alba
# chage -d 0 alba

command above will delete the user password and he/she will required to set a new password when connecting via ssh without needing to enter the old password, good for resseting forgotten user password :)

Posted under: BSD/unix, Tips & Tricks

Tagged as: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

hero ;) :| :x :twisted: :tido: :tensen: :swt: :spot: :sleepy: :shock: :run: :roll: :pasrah: :oops: :o :nono: :nangis: :muzik: :mrgreen: :mabuk: :lol: :kerek: :joget: :idea: :hedban: :evil: :desk: :cry: :cayo: :bored: :blur: :arrow: :amok: :P :D :?: :? :33: :32: :31: :30: :29: :28: :27: :26: :25: :24: :23 :22: :21: :20: :19: :18: :17: :16: :15: :13: :12: :11: :10: :09: :08: :07: :06: :05: :04: :03: :02: :01: :) :( :!: 8O 8)