When we create a Linux user, unless we explicitly mention a parameter, the user gets the default value.
To display the default values of a user, we use the below command:
Creating a user with a home directory:
We use the below command to create a user with a "home" directory:
-m : will create a home directory and copy the needed configuration files into "Albert's" directory "/home/Albert".
We then need to define a password for our user using the below command:
The command "useradd Albert" doesn't create a "home" directory for the user "Albert".
Changing the default parameters for a user:
For example, we could set a specific "user ID" and "group ID" for a user, using the below command:
-u: user ID
-g: group ID
-g: group ID
-m: instructs the "useradd" to create a "home" directory for the user.
Changing the system's defaults:
For example, we could change the default expiry date for the passwords using the below command:
MM: the month, "06" for example.
DD: the day of the month, "01" for example.
Modifying the parameters of the users:
We could use the "usermod" command to change a user's parameters.
For example, we could change the "shell" of a user, using the below:
Locking and unlocking user' accounts:
To prevent a user from logging into the system, we use:
Preventing a user for logging in:
To prevent a user for logging in directly on the machine, we use:
To set an expiry date to the "22-05-09" for a user's password, we could use the below command: