Any user created on Linux may or may not have a password. Linux stores passwords in encrypted format in /etc/shadow. Here is quick command line code to find if a user has password set.
$ sudo cat /etc/shadow | grep www-data www-data:*:16519:0:99999:7:::
Second field in above output is *. That means user does not have an encrypted password set. Sometime you may also see “!” or empty string as placeholder for password. That also means that password is not set.
Here is an entry for a user which has password set:
$ sudo cat /etc/shadow | grep user2 user2:$1$KNO15fOz$xMef3ieizYZmKrbhK1IAR/:16767:0:99999:7:::
Note the value of a valid encrypted password “$1$KNO15fOz$xMef3ieizYZmKrbhK1IAR/”. It also has the seed “KNO15fOz” in it.
Delete password for a user
In case you want to delete password for a user, you can run
$ sudo passwd -d user2 passwd: password expiry information changed. $ sudo cat /etc/shadow | grep user2 user2::16767:0:99999:7:::