User Account Creation¶
Create User Account in Linux¶
Create User Account with default configuration:¶
Create User Account using useradd command:¶
To check the defaults for user account creation while `useradd` command is used
1\. Check with the command `bash useradd -D` 2\. Check the file `bash cat /etc/default/useradd` `bash cat /etc/login.defs`Create User Account using adduser command:¶
To check the default configuration information¶
Check the files¶
Process of User Account creation¶
- Selecting UID and GID for the user as per defined in /etc/login.defs (UID_MIN, UID_MAX, GID_MIN and GID_MAX)
- Creating new Group Account with same name as the user, adding new line entry to the file
/etc/group - Creating the User Account with UID and GID and adding new line entry to
/etc/passwd - Adding User Account to the Group Account, modifying the line added to the file
/etc/groupin step 2 - Creating User's Home directory, and modifying the line added to
/etc/passwd - Copying file from
/etc/skelto user's home directory - If user has setup password, it will modify the file
/etc/shadow - If addition info like Full Name, Room Number, Work Phone, Home Phone and Other is set, that will modify the file
/etc/passwd
Creating a user account without using the default settings¶
Manually specifying UID¶
or
Manually specifying GID of the user account¶
or
Manually specifying Primary Group Name for the user account¶
Manually specifying range for UID and GID¶
Manually adding user to secondary groups¶
Create User without creating default group¶
or
Manually specifying default shell for user¶
or
:::info
To check available shells on linux host¶
:::Creating User Account with custom Home Directory¶
:::info Ensure that argument mentioned in option -d or -b should not end with /. :::
Manually specifying existing directory as User's Home Directory¶
Note
- The user account created using `-d /Other/Home` then the /Other/Home becomes user home directory - The Home directory permissions will not be modified - The contents from the `/etc/skel` will not be copied to the Home directoryManually specify the not existing directory to be a User's Home Directory¶
:::info Note
- The path to Home directory should exist if not it throws warning
- The Home directory should not exist if it exists then
- No files will be copied from
/etc/skel - User will not be the owner of the Home Directory :::
- No files will be copied from
Creating User Account having Home Directory in Other Directory¶
:::info Note
Base Directory is a directory that holds users home directory :::
Create User Account with Custom Group¶
Create user account without creating default group account¶
Manually specifying GID or Group Name of the Primary group of the user account¶
or
or
:::info Note
Points to be noted
- In useradd command gid or group name of the Group can be specified as an argument to -g
- In adduser command GID can be specified in --gid and GROUPNAME can be specified in --ingroup option
- Ensure that the groups which are specified are already existing on the system :::
Manually specifying range for UID and GID¶
Manually adding user to secondary groups¶
Create User Account with Custom Account Settings¶
Specify different Skel directory¶
Specify UID¶
or
Specify GID¶
or
Specify the range of UID¶
Specify the range of GID¶
Specify Shell¶
or
Create Group Account in Linux¶
Creating group account in linux¶
or
Creating group account by specifying its GID¶
or