In this manual, we will deal with the following topics:
Below you will find the steps for each of the mentioned topics.
How to create a new user in GNU/Linux operating systems
In the first place, it will be an indispensable requirement to have SSH/terminal access to an account with superuser permissions. For example, the "root" user account.
Next, we will use the command useradd to create the user. The syntax is the following:
useradd -opciones nombredeusuario
For the purposes of this manual, we will only consider the "-m" option that allows us to specify whether or not we want to create a "Home" directory with the same name as the user we created.
Create a user with home directory:
useradd -m nuevousuario
Create a user without home directory:
How to assign a password to the new user
Changing the password of the new user (or any other user of the system) is as easy as executing the following command as superuser.
Next we will be asked to enter the password and confirm with the "ENTER" key. Then we will be asked to repeat it for security reasons.
Important: during the process of password assignment, the keyboard will not seem to work, however what happens is that the characters entered are invisible. You should type the password normally, being aware that you simply cannot see what is being written.
How to assign or change a home directory to the new user
If during the process of creating the new user we have not specified a home directory (or if we want to modify the directory of an existing user), we can use the command "usermod".
The syntax is the following:
usermod -m -d /home/directoriodestino/ nombredeusuario
The "-d" option allows you to specify the path of a non-existent directory. It is important that this directory does not exist previously.
The option "-m" allows to indicate that all the content must be moved to the new directory. Useful in the case of an existing user.