Users
Last updated
Last updated
A user is an entity, in a Linux operating system, that can manipulate files and perform several other operations. Each user is assigned an ID that is unique for each user in the operating system.
After installation of the operating system, the ID 0 is assigned to the root user and the IDs 1 to 999 (both inclusive) are assigned to the system users and hence the ids for local user begins from 1000 onwards.
In a single directory, we can create 60,000 users.
Now we will discuss the important commands to manage users in Linux.
AWK command
To list out all the users in Linux, use the awk command with -F option. Here, we are accessing a file and printing only first column with the help of print $1 and awk.
ID command
Using id command, you can get the ID of any username. Every user has an id assigned to it and the user is identified with the help of this id. By default, this id is also the group id of the user.
Useradd command
The command to add a user. useradd command adds a new user to the directory. The user is given the ID automatically depending on which category it falls in.
The username of the user will be as provided by us in the command.
Password command
Using passwd command to assign a password to a user.
After using this command we have to enter the new password for the user and then the password gets updated to the new password.
User Configuration
This commands prints the data of the configuration file. This file contains information about the user in the format.
Usermod command
The command to change the user ID for a user.
Change User Login Name command
You can change the user login name using usermod command. The below command is used to change the login name of the user.
The old login name of the user is changed to the new login name provided.
User Directory setup command
The command to change the home directory.
The below command change the home directory of the user whose username is given and sets the new home directory as the directory whose path is provided
Delete user
You can also delete a user name. The below command deletes the user whose username is provided.
User Database Files