OpenBSD User Management - Beginner Guide

OpenBSD User Management - Beginner Guide

Managing users and groups is essential for multi-user systems. Here's how to do it safely.

Step 1: Create a New User

You'll likely want users other than root for daily work.

From the command line:
adduser
Follow the interactive prompts:

Full name: Your Name
User name: yourname (this becomes the login name)
Uid (Leave empty for default) - press Enter
Group: wheel (adds user to wheel group for admin privileges)
Login class: default - press Enter
Shell: /bin/bash (or /bin/ksh)

Enter new password:
Type your password (it won't be displayed)
Enter new password again:

Login class:
Press Enter to accept default

OK: yourname has been added to the user database.

Alternatively, use the GUI:
xpms (if X Window System is running)
Or look for "Users and Groups" in your system menu.

Step 2: Understand User Groups

OpenBSD uses groups to manage permissions.

Important groups:
wheel - users in this group can use doas to run as root
operator - similar to wheel, older style
auth - users allowed to log in
service - accounts used by services (like apache, sshd)
cdrom - members can use CD/DVD drives
floppy - members can use floppy drives (rarely used now)
private - private groups auto-created for new users

Step 3: Add User to Group

If you created a user and want them to have administrative privileges:

usermod -G wheel yourname

What this does: Adds yourname to the wheel group.

Now your user can:
doas command - run commands as administrator
doas reboot - reboot the system
doas vim /etc/config.conf - edit configuration files

Step 4: Change User Password

To change your own password or another user's:
passwd - changes your own password
passwd yourname - changes another user's password

You'll be prompted to enter the new password twice.

As root to change any user's password:
passwd -r files yourname (using files database)

To check if password was changed:
passwd -S yourname - shows password status

Step 5: Delete a User

When a user is no longer needed:

deluser yourname - removes the user account

Important: This removes the user but may leave their home directory and files.

To also remove the home directory:
deluser -r yourname - removes user and their home folder

Caution: This permanently deletes all files in the user's home directory!

Step 6: List All Users

To see all users on the system:
cat /etc/passwd - shows all user accounts (view only)

cat /etc/group - shows all groups and their members

Or use simpler commands:
whoami - shows your current user
groups - shows which groups you belong to
id yourname - shows user ID and group memberships

Ready for more user management? Proceed to Lesson 14: Users and Groups.

Article author: Arthur Isaev