User Tools

Adding a User

If you are doing this as root, don't use the 'sudo' command.

To add a user to the system:

  1. Issue the useradd command to create a locked user account:
sudo useradd <username>
  1. Unlock the account by issuing the passwd command to assign a password and set password aging guidelines:
sudo passwd <username>

If you get the following error:

bash: useradd: command not found

Try

sudo /sbin/useradd <username>

Or

sudo /usr/sbin/useradd <username>

Examples

See what groups the user is in:<br /> id -nG {user-name} <br /> Add user and specify home directory while adding to groups:<br /> sudo useradd -d /home/testuser -m testuser -G adm,dialout,cdrom,plugdev,lpadmin,sambashare,admin <br /> Add user to a group: <br /> sudo useradd -a -G admin testuser <br /> To modify (or remove from) group membership, just specify explicitly: <br /> sudo useradd -G adm,dialout,cdrom,plugdev testuser <br />

References

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information