OpenBSD Change Password For Root and Other Users

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.

ADVERTISEMENTS

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.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
2 comments… add one
  • Brett Jan 27, 2015 @ 20:06

    What about changing the user to root? How do you change to the root user without logging out?

    • Eduard Borsos Oct 18, 2016 @ 7:23

      Simply type:

      $ su –

      You will be prompted for the superuser password.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.