December 12, 2018

How to Add a User to the Wheel Group on FreeBSD

FreeBSD Logo

Sometimes you need to add a regular user to the wheel group.
You can do this by directly editing the /etc/group file but there is a more comfortable way with the pw command. With this command you can add, modify and remove users and groups on FreeBSD.

Root access is required to edit the following files and to execute commands. Log in as root (su) or simply prepend sudo to all commands that require root privileges.

Add a new user to the wheel group

The following command will create the user joe and add this user to the wheel group.

pw useradd joe -G wheel

The joe group will be created as well. Use the -g option if you want to add the user to an other default group.

Add an existing user to the wheel group

For users who already exists you can use the groupmod command.
The next command will add the user joe to the wheel group.

pw groupmod wheel -m joe

Speak Your Mind