To add a user to a group in FreeBSD, you can use the pw
command with the usermod
option. For example, to add the user john
to the group wheel
, you can use the following command:
pw usermod john -G wheel
This will add the user john
to the group wheel
.
Alternatively, you can use the usermod
command with the -aG
option to add a user to a group. For example:
usermod -aG wheel john
This will also add the user john
to the group wheel
.
It's important to note that you may need to be logged in as the root
user or have superuser privileges in order to add a user to a group.
You can verify that the user has been added to the group by using the id
command:
id john
This will print out information about the user, including the groups that they belong to.