There are
two type of users in Linux. They are System users and Normal Users. Each user
will have a unique ID called UID.
User Type
|
UID Range
|
System Users
|
0 to 999
|
Normal User
|
1,000 to 60,000
|
The user
information is stored in the following files.
/etc/passwd
– User information is stored
/etc/shadow – password information of the users is stored in this file
/etc/shadow – password information of the users is stored in this file
Let us
discuss more about each file.
In
/etc/passwd file, the user details are present in the below format.
Here UID and
GID are auto generated by the system. Every user will have a unique user ID
(UID) and group ID (GID).
The default
home directory in Linux is /home/<username>.
There are
few tools like DES (64 bits), MD5 (128 bits), SHA (512 bits) which will encrypt
the password in linux. In RHEL 7, SHA is the default tool.
The tool used to encrypt the password of a specific user can be found using the command
passwd –S <username>
the output looks like the below.

Below are the basic command for user administration.
Create a
user: useradd <username>
change the user password: passwd <username>
lock the user account: usermod –L <username>

change the user password: passwd <username>
lock the user account: usermod –L <username>

Verification: The “!”
mark before the encrypted password represents the account is locked.
Now let’s
check the usermod command to change each property of /etc/passwd file.
1) Change the user name: usermod -l <new_name>
<old_name>
2) Change the user ID: usermod –u <new_uid> -o <user_name>
(-o
is applied when the same UID is used for two users).
3) Change
the comments of a user: usermod –c
“<new_comments>” <user_name>
4) Change
the user home directory: usermod -m -d
<new_directory_fullpath> <user_name>
(here –m to move the current home directory content to new home directory)
the default home directory information can be found in the file /etc/default/useradd

(here –m to move the current home directory content to new home directory)
the default home directory information can be found in the file /etc/default/useradd

5) Delete
a user including home directory and mail spool
userdel –r <<User_Name>>
userdel –r <<User_Name>>
6) Change
the user login shell: chsh –s <new_shell_name>
<user_name>
The available shells on the linux box can be found at /etc/shells
The available shells on the linux box can be found at /etc/shells
Change the maximum days of the passwd
expiry.

Groups:
The groups information is found in the fail /etc/group
create a new group
# groupadd <<New_Group_Name>>
Append a secondary group to the user
# usermod –aG <<Secondary_Group>> User_Name
List all groups a user belongs to. Here testacl is the user


Groups:
The groups information is found in the fail /etc/group
create a new group
# groupadd <<New_Group_Name>>
Append a secondary group to the user
# usermod –aG <<Secondary_Group>> User_Name
List all groups a user belongs to. Here testacl is the user

Set-GID for directories:
By doing this. The newly created child objects will have the current group of dir1

By doing this. The newly created child objects will have the current group of dir1

No comments:
Post a Comment