Samir Parikh / Blog


Originally published on 27 December 2018

When creating the initial user for my FreeBSD VM on Azure, I wasn't able to initially set a user password as I was logging in via an SSH key. When I tried setting a password, I would be greeted with the following error:

$ sudo passwd $(whoami)
Changing local password for username
New Password:
Retype New Password:
passwd: entry inconsistent
passwd: pam_chauthtok(): Error in service module

A quick search brought me to this mailing list message which suggested trying to use pwd_mkdb(8) to fix the /etc/master.passwd file. Once I ran pwd_mkdb /etc/master.passwd as root, I was able to successfully use the passwd(1) command:

$ sudo passwd $(whoami)
Changing local password for username
New Password:
Retype New Password: