How to add users to a system?#
The command used to create a new user is called useradd
.
Just by running useradd your_user
a new user named your_user will be created, but you probably want to add some parameters.
The options of the useradd
command are:
-m
This will create a home directory in/home/your_user
-G group_name
will add the newly created user to the here specified groups (wheel
is an often used group since it allows the user to usesudo
)-s path/to/shell
changes the default shell of the user. The available shells and their paths can be checked withcat /etc/shells
. If the shell you want to use is not available it can be installed using the OSs package manager.
Modifying an existing user#
In case you forgot to set something when creating the user, you can do that afterwards using the usermod
command.
-aG
to add another group to a user-s
to change the users default shell
For any additional options you might want to know you can always check the man pages using man usermod
or any other command.