I am a new Linux user. I would like to disable a password for an account. How do I delete user Password under Linux operating system using command line option?
All user passwords are stored in /etc/shadow file. The quick way to remove/delete a user password is pass --delete option to the passwd command. First, login in as a root user using sudo command/su command and type the following command:
Command to delete user password under Linux
Type the following command to delete a user password:
# passwd --delete username
# passwd -d username
$ sudo passwd -d sweta
Removing password for user sweta.
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. It is also a good idea to setup user shell to nologin to avoid security related problems:
# usermod -s /usr/sbin/nologin usernameFor example to delete password for user sweta, Type:
# passwd -d sweta
# usermod -s /usr/sbin/nologin sweta
Use the following chage command/grep command (feel free to replace the username sweta with actual username):
# chage -l sweta
# grep sweta /etc/passwd
# grep sweta /etc/shadow