How to add users on FreeBSD using adduser or pw

How to add users on FreeBSD using adduser or pw

To add a new user on a FreeBSD system, you can use the adduser or pw command.

Using adduser

  1. Open a terminal and log in as the root user or a user with sudo privileges.

  2. Run the adduser command with the -m option to create a new user and a home directory for the user. For example:

re‮t ref‬o:lautturi.com
adduser -m username
  1. You will be prompted to enter a password for the new user. Enter a secure password and confirm it.

  2. 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.

  3. You can use the -s option to specify a different login shell for the user. For example:

adduser -m -s /bin/csh username
  1. You can use the -G option to add the user to one or more groups. For example:
adduser -m -G wheel,operator username

Using pw

  1. Open a terminal and log in as the root user or a user with sudo privileges.

  2. Run the pw command with the useradd subcommand to create a new user. For example:

pw useradd username
  1. You will be prompted to enter a password for the new user. Enter a secure password and confirm it.

  2. 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.

  3. You can use the -s option to specify a different login shell for the user. For example:

pw useradd -s /bin/csh username
  1. You can use the -G option to add the user to one or more groups. For example:
pw useradd -G wheel,operator username

Note: The adduser and pw commands have many other options and features that you can use to customize the user account. Refer to the man pages for more information.

Created Time:2017-10-28 21:38:58  Author:lautturi