In Linux, a user is an account that allows an individual to interact with the system. Users are identified by a username and are associated with a unique User ID (UID) and a primary group. Users are defined in the /etc/passwd file, and additional information is stored in the /etc/shadow file for password-related details.
Here’s a breakdown of the common parameters associated with user definition in Linux:
- Username (Login Name): A string of characters used to identify a user when logging in. It is stored in the /etc/passwd file.
- User ID (UID): A unique numerical identifier assigned to each user. It is also stored in the /etc/passwd file.
- Group ID (GID): The primary group associated with the user. It is stored in the /etc/passwd file.
- Home Directory: The location where a user’s files and personal settings are stored. It is stored in the /etc/passwd file.
Login Shell: The command interpreter or shell that is started for the user when they log in. It is stored in the /etc/passwd file.
In Linux, the useradd
command is used to create a new user. The basic syntax of the useradd
command is as follows: useradd and username (student). This below command will create username student.

Here are some commonly used parameters for creating a new user in Linux:
Parameters:
-c, --comment COMMENT
: Provides a comment or description for the user.-m, --create-home
: Creates the user’s home directory.-g, --gid GROUP
: Specifies the initial login group for the user. You can use either the group name or GID.-G, --groups GROUP1[,GROUP2,...]
: A list of supplementary groups for the user.-s, --shell SHELL
: Sets the user’s login shell. Common shells include Bash, Zsh, etc.-u, --uid UID
: Specifies the user ID for the new user.-p, --password PASSWORD
: Sets the encrypted password for the new user. You can generate this using thecrypt
command or usepasswd
to set it later.-e, --expiredate EXPIRE_DATE
: Sets the account expiration date. The date format is YYYY-MM-DD.-r, --system
: Creates a system account. System accounts are typically used for system processes and don’t have a password.
Setting Password: After creating a user, you might want to set a password using the passwd
command. For example:

- This command prompts you to enter a password for the new user.
Remember that managing user accounts and permissions requires superuser privileges, so you’ll often use sudo
with these commands to execute them with elevated permissions.