Create users on Linux (via command line)
In linux through the shell we can manage users in a very easy way just with the command line.
Unlike other operating systems where certain settings are hidden in records, databases and applications, in linux most settings are in their elementary form in plain text.
The password files are in / etc / passwd, it is an editable text file.
Each line in the file is a user.
This file does not contain users' passwords, but only their basic settings.
Through the text editor or even manually it is possible to insert a new user.
To set your password, use the command:
passwd <username>The / etc / passwd file consists of 7 mandatory fields, separated by colons.
<login>:<password>:<user uid>:<group>:<description>:<directory of user>:<login application>Note: The password field if you use the character "x", means that the password will be recorded encrypted using the passwd application.
ricardo:x:0:0:Ricardo:/:/home/ricardo:/bin/bashAfter saving the document, use the command for "ricardo":
passwd ricardoYou will be asked for the password and entering the new password, then the user will be created. To remove the user, simply edit the / etc / passwd document and remove the user's line.
No comments