Linux is a multi-user and multitasking OS. In Linux, you can create any number of the user account and groups. A user is the connected to a particular group and there can are any number of the groups as well.
The user home directory by default is created under "//" directory with the user name. e.g. User Techbie has home directory "/home/techbie" and the mail account is created under "/var/spool/mail/".
Each user and group in the system are identified by a unique no called as ID.
/etc/passwd
The file whare system user account definition was done is/etc/passwd. This file has the following strucutre
#cat/etc/passwd
Username:a:500:500:some comments:/home/username:/bin/sh
Username:
The System account username. It should not start with a number or include uppercase letters
A
The password. As a points To/etc/shadow for the password. An * means the account is disabled. A Random Group of letters and numbers represents the encrypted password
500
The user ID (UID) for the user
500
The group ID (GID) associated with that user
Some comments
Any information can is used in this field
/home/username
By default, RHEL places new home directories In/home/username
/bin/sh
Default User Shell
In order Add/delete users to the system this file can is edited directly with VIPW or using Useradd/userdel commends a des Cribed in next sections
/etc/group
The file where System group account definition was done is/etc/group. This file has the following structure
#cat/etc/group Groupname:x:500:user1,user2
GroupName
The SYSTEM account groupname user gets this own group. By default if a user is crated are related to a group with GroupName equal to username
X
The group password. An X points To/etc/gshadow for the password as user password on/etc/passwd random group of letters and numbers represent s the encrypted password
500
The group ID (GID) associated with user
User1, User2
Lists of users that belong T the group If It's blank means that there are a username that's identical to the GroupName
In order to add/delete groups to the system this file can is edited directly with VIGR or using Useradd/userdel commands a s described in net section
/etc/shadow
The/etc/shadow file is can was read for every user on the system so include the encrypted password there are not a good IDE A. For this reason the File/etc/shadow accessible to root are used to store the encrypted password
#/etc/shadow
Username: $1sdsew$ed%[email protected]: 14860:0:99999:7:::
Username
Username Shadow entry, it's related with Username account on/etc/passwd
$1sdsew$ed%[email protected]
Encrypted password. An x in the second column of/etc/passwd means the encrypted password are stored here
14860
Last password changed date. In the Linux epoch number if days:number of days after January 1, 1970
0
The values of 0 here means, this user can keep this password forever
99999
The system would ask to user-to-change he password after 99999 days since account creation
::
The values means the number if days before password expiration when are made a warning are given in this case none
::
The sets the no of the days after password expiration if an account was made inactive in this case none
::
The values means the number if days after password expiration when a account was disabled in this case none
Adding User account:
When a user account needs to being added to the system the commend Useradd must is used:
# useradd-u 678-c "Test Add User"-d/home/techbie-s/bin/bash Techbie
With this command we had created the user account Techbie with uid=678 which home directory In/home/techbie and default Shell bash. By default, the user is assigned to a new created group silicon with gid=678. This values can be changed using THE-G option
#cat/etc/passwd
Techbie:x:678:678:test Add User:/home/techbie:/bin/bash
Deleting User account:
When a user account needs to being removed in the system the commend Userdel must is used:
# Userdel R Techbie
With this commend all information about Techbie account in removed on the system, including all home directory and mail sp ool files.
Modifying user account:
I order to change the parameters of a existing account the commends Usermod and/or chage can be used
# Usermod e 2016-07-30 Techbie
Sets the expiration account day for user ' Techbie ' to 2016-07-30
# usermod G Sales Techbie
Sets ' Techbie ' account group ownership to sales group
# chage E-1 Techbie
Removes any account expiration date for user "Techbie"
# usermod ExpireDate 2016-07-30 Techbie
Sets the expiredate for a user account Techbie
# passwd D Techbie
Disable the user account Techbie
# passwd U Techbie
Unlock the user account Techbie
Linux User and Group Management