How do I change root user or any other user account password under OpenBSD operating systems?
Introduction – You need to use the passwd command on OpenBSD. It can changes the user’s local password stored in /etc/master.passwd file, Kerberos, or YP password. A root user can change any users password. A normal user can only change their password on OpenBSD. This page explains to you how to change the OpenBSD Unix root and user account password using the passwd command command line options.
OpenBSD passwd command syntax
If not [user] name specified the user’s login name used, i.e., your password will change. First, the user prompted for their current password. If the current password correctly typed, a new password set for a given [user] account. The new password must be entered twice to avoid typing errors.
OpenBSD change password for root user
Login as root user using the doas command or su command:
$ su -
To change root user account password, run:
# passwd root
Please note that the new password should be at least six characters long and not wholly alphabetic. Its total length must be less than _PASSWORD_LEN (currently 128 characters). A mix of both lower and uppercase letters, numbers, and meta-characters are encouraged.
How to change other user account password on OpenBSD
You must log in as the root user. Therefore, log in as the root user:
$ su -
The syntax is as follows
To change the password for tom user account, enter:
# passwd tom
# passwd vivek
How to change change your own password on OpenBSD
Simply type the passwd command:
First, the user always prompted for their current password. If the current password entered correctly, a new password set in system’s /etc/master.passwd file. The new password must be entered twice to avoid typing errors.
This quick tutorial taught you how to change the OpenBSD Unix root user and other user account password using the passwd command. You must be root user to change the password for all other users, however users can change their password without sudo access. For more info see this page.