How to remove the password from a user account on FreeBSD

Default for most accounts I create I use SSH keys, therefore I do not want accounts to have a password set.

Instead of leaving the password blank it is better to disable logging in using a password.

This can be done with the following command:

You can check the result with vipw

For example, you will see the following line if we look at the root user:

The asterisk defines that no logins with a password are allowed.


If you want more information about the -w argument be sure to check out the manual of pw(8) to see the other available options.