Skip to content
Step by Step Internet 馃寪 Guides for learning to surf the Net

How to create users in Linux from any distribution easily and quickly? Step by step guide

One of the outstanding features of Linux is its multi-user functionality, which allows several people to access the server applications and resources at the same time without putting your safety at risk.

So that users can interact smoothly, administrator is required to assign credentials that will be verified at the time of entry. The process is not complicated at all, but the method must be followed precisely to avoid errors occurring that force us to start from scratch.

However What is the way to create users in Linux regardless of the distribution you have installed? That is one of the questions that we are going to answer in this course. In addition, we will detail how to manage them and the commands that will allow you to carry out the process as an expert.

What is a user in Linux and how are they classified in this open source operating system?

The expression user refers to an account with a certain amount of resources or permissions to perform a certain task or activity that is assigned to a person, computer or application. This organization allows that the functions performed by one of them do not endanger the operation of the system or the work of the rest of the operators. In general terms, In Linux users belong to two groups: primary and secondary, classified into normal, special and root.

Next we see its main characteristics:

Normal

User Keys in Linux

They are the users who frequently use the system and you only have access to modify your environment. It is recommended to use this function for daily work and leave superuser functions only to execute more complicated commands, that compromise weighty tasks.

Specials

Some assume “root” privileges depending on the type of account, in order to safeguard the security of the system. Once the distribution is installed they are created automatically and do not have any access credentials.

Root

He performs the functions of administrator of user accounts and does not have any limitation regarding permissions and privilegess. This feature is especially useful when you need to run certain commands related to the file system, perform maintenance, install tools, and modify the kernel.

Learn step by step how to create a user on any Linux distribution like an expert

Create users on Linux

Many current distributions allow you to create users graphically, In our tutorial we are going to teach you how to do it from the Linux terminal. The procedure is not complicated and has at least two advantages: it is safe and it is suitable for any distribution.

The steps to follow are those:

  • We enter as user “Root” from the Linux terminal with this command: $ su.
  • For activate the privileges you must enter the password. When you do, you will see that the symbol “$” by “#”.
  • When the “Root”, we begin to create the user account with this code: # useradd nombre_usuario
  • I already we assign a name to this user account and now we will put a password with this command: # passwd nombre_usuario
  • The system asks us to enter the password twice to verify the digits. If everything has been done properly, we will have created the new user account.

We teach you in detail how to manage users in the Linux operating system in the most efficient way possible

User manager tasks include create the account, modify it and even delete it when the time is right.

In order to do the job properly, you must know some commands and their respective function:

Commands for user management

Batch user management

What is the function of commands in user administration? They allow us to analyze account details and better manage it.

Here are some of the most used:

  • Chage– Controls the date the password or user account expires.
  • Chpasswd– Change or create passwords in batch for multiple users.
  • Id: gives detailed information about the user and the groups to which they belong.
  • Gpasswd– Sets the passwords for each group as well as you can delete, add, or list users.
  • Groupadd– Create group accounts in the operating system.
  • Groupdel: Delete any groups that have been created.
  • Groupmod: modifies the groups.
  • Groups: indicates in which groups the user is included.
  • Newusers– Create or update users in batches.
  • Pwconv: triggers shadow protection, which enhances system passwords.
  • Pwunconv– Removes shadow protection from the distribution.
  • Useradd– Add new users to the database.
  • Userdel: delete users from the system.
  • Usermod: change and add roles to users.

Edit users

Edit users in Linux

Now we focus on edit or modify a user that has already been created previously, either to add or to decrease functions.

The command that will take us through the path is “usermod” and to make the changes you have to carry out the following steps:

  • To change the username: #> usermod –l seguido de (nombre actual) y (nombre nuevo)
  • With this the boot name will be changed.
  • Now we modify the description of the account and its main group with this command: #> usermod -c "supervisor de area" -s /bin/ksh -g 505 (nombre de usuario)
  • So that no one use the account when the user is on permission, we add this command: #> usermod –L (nombre de usuario)

Change user password

Change user password in Linux

For whatever reason, at some point we will need to change the password, it could be for example because the allotted deadline has expired. In this case we will use the command “Passwd”, which not only helps to create it but also to modify it.

The steps to do it successfully are as follows:

  • Enter the terminal and type this command: sudo passwd.
  • There he will ask that enter the new password with this message: Enter new UNIX password.
  • And then it will ask you to confirm the password: Retype new UNIX password.
  • If you have done it successfully, This message will appear on the screen: passwd: password updated successfully”.

On the other hand, to change the password of another user you must enter as root, using the same command passwd.

The steps to follow are these:

  • After logging in as root, type this command: passwd nombre_usuario, at the end is the name of the person we want to modify.
  • Then It will ask us to create the new key with this command: Enter new UNIX password.
  • And then we It will tell us to verify it: Retype new UNIX password
  • A) Yes we will have everything related to the password updated.

Delete users

Delete users with commands in Linux

Now, we want a user who no longer works with us to be removed from the system. We will do it using the command “Userdel”, which deletes the account but not the information that was uploaded.

The way to do it is like this:

  • Enter the command #> userdel followed by the person’s name.
  • If we use this code #> userdel –r (nombre) I know remove everything, including mail, directories and files. If the user is active at that time, the function cannot be fully executed.
  • On your side, if we type #> userdel –f (nombre) I know suppress everything, regardless of whether the user is currently connected to the network.

How did you find out, all the steps they are simple and the procedures easy to execute. That way the system is kept orderly and best of all, security is preserved.