OpenBSD Change Password For Root and Other Users

last updated in Categories , ,

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

passwd
passwd [user]

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
OpenBSD Change Password for root user command
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
passwd {userName}
To change the password for tom user account, enter:
# passwd tom
OR
# passwd vivek

OpenBSD change a user account password command
OpenBSD change a user account password command

How to change change your own password on OpenBSD

Simply type the passwd command:
$ passwd
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.

Conclusion

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.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at www.nixcraft.com

Historical Comment Archive

2 comment

    Have a question? Post it on our forum!