To add a new user on a FreeBSD system, you can use the adduser or pw command.
Open a terminal and log in as the root user or a user with sudo privileges.
Run the adduser command with the -m option to create a new user and a home directory for the user. For example:
adduser -m username
You will be prompted to enter a password for the new user. Enter a secure password and confirm it.
The adduser command will create a new user and a home directory for the user in the /usr/home directory. The user's login shell will be set to /usr/local/bin/bash by default.
You can use the -s option to specify a different login shell for the user. For example:
adduser -m -s /bin/csh username
-G option to add the user to one or more groups. For example:adduser -m -G wheel,operator username
Open a terminal and log in as the root user or a user with sudo privileges.
Run the pw command with the useradd subcommand to create a new user. For example:
pw useradd username
You will be prompted to enter a password for the new user. Enter a secure password and confirm it.
The pw command will create a new user with a default home directory in the /usr/home directory. The user's login shell will be set to /usr/local/bin/bash by default.
You can use the -s option to specify a different login shell for the user. For example:
pw useradd -s /bin/csh username
-G option to add the user to one or more groups. For example:pw useradd -G wheel,operator username
Note: The
adduserandpwcommands have many other options and features that you can use to customize the user account. Refer to the man pages for more information.