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 :)