By Vivek Gite Source: https://www.cyberciti.biz/faq/how-to-add-users-on-freebsd-using-adduser-or-pw/
FreeBSD is Unix like general-purpose operating systems. FreeBSD provides various tools to add, modify, and remove local user accounts using the CLI. This page shows how to add users on FreeBSD operating systems using useradd and pw commands.
Add users on FreeBSD
The procedure is as follows:
- Open the terminal app
- Switch to root user account using sudo -i OR su –
- Run adduser command for adding new users on FreeBSD interactively
- Delete user using rmuser command
Let us see all examples in details. First, list all shells on system using the grep command:
grep '/bin/' /etc/shells
Creating FreeBSD users from the command line using adduser
Log in as root user using the sudo command/su command:
sudo -i
Create the vivek user on FreeBSD, run:
adduser

Confirm that user exists in the system
Run the following cat command or grep command/egrep command:
cat /etc/passwd
tail -1 /etc/passwd
grep '^username' /etc/passwd
grep '^vivek' /etc/passwd

Please note that the /etc/passwd files stores user names and other information. The /etc/passwd file is generated from the /etc/master.passwd file by pwd_mkdb command.
How do I change or set the password for vivek user

Run the passwd command as follows:
passwd vivek
FreeBSD allow sudo privileges for user
Make sure sudo is installed on FreeBSD and wheel group is allowed as follows:
# visudo
Sample outputs:
## Uncomment to allow members of group wheel to execute any command %wheel ALL=(ALL) ALL |

Save and close the file. Any FreeBSD user who is a member of the wheel group can run a command using sudo. Use the id command to find out if vivek is part of wheel group
# id -Gn vivek
vivek wheel
If not add user vivek to the wheel group, run:
# pw groupmod wheel -m vivek
Verify it using the /etc/group file
# id -Gn vivek
# grep '^wheel' /etc/group
How to delete or remove user account
The rmuser command removes one or more users submitted on the command line or from a file in FreeBSD operating system. Run:
# rmuser username
# rmuser
## delete user named marlena
# rmuser marlena

Confirm that marlena user is successfully deleted from FreeBSD box:grep '^marlena' /etc/passwd
cat /etc/passwd
id marlena
Sample outputs:
id: marlena: no such user
How to use pw command
The pw command create, remove, modify & display system users and groups. It has many more options. For example:
pw user help
pw user add help
pw user del help
pw user mod help
pw group help
pw lock help
pw unlock help
In this example, add user named marlena as follows:
# pw user add -n marlena -c 'Marlean Root' -d /home/marlena -G wheel -m -s /usr/local/bin/bash
Where,
- -n marlena : login name
- -c ‘Marlena Root’ : user name/comment
- -d /home/marlena : home directory
- -G wheel : additional groups (add to wheel group)
- -m : create and set up home
- -s /usr/local/bin/bash : name of login shell
One can local and unlock FreeBSD user using the pw command:
# pw lock marlena
# pw unlock marlena
See pw command man page for more info:
man pw