Sa1 Chapter 6
Sa1 Chapter 6
1- Describing User and Group Concepts ===== System User, Normal User, Group
2- Managing Local User Accounts ===== useradd, usermod, userdel
3- Managing Local Group Accounts ===== groupadd, groupmod, groupdel
4- Managing User Passwords ===== Passwd, chage
5- Gaining Superuser Access ===== Wheel, sudoers
================================================================================
Normal Users
UID – 1000 To 65535
================================================================================
➢ When a User is Created in Linux / Unix, The Following are Also Created by
Default:
================================================================================
Options:==========
-u UID
-g Primary group
-G Create user in Secondary group
-G Add User in Multiple Groups
-c Create User with Comment
-d Change Default Home Directory
-s Create user With Specific Login Shell
-M Create user Without Home Directory
-N Create user Without Primary Group
-r Create user With UID less that 1000
================================================================================
PRACTICALS:==========
=====: Create User Syntex:- useradd <username> ; echo “Password” | paswd username
--stdin
=====: Create User in Multiple Group Syntex:- useradd -G <Grp> <Grp> <username>
=====: Create User Specific Shell Syntex:- useradd -s <New Shell> <username>
Note:- User Can't Login Because it has Not Permission on /home Direcrory.
=====: Create System User Less Than 1000 UID Syntex :- useradd -r <username>
Linux2:x:974:974::/home/Linux2:/bin/bash
[root@JAVED ~]#
================================================================================
OPTIONS:-
-c ===== Comment Add the user's real name to the comment field
-g ===== Group Specify the primary group for the user account
-G ===== Groups Supplementary groups for the user account.
-a ===== Append Used with the -G option to add the supplementary
groups
to the user's current set of group memberships
instead of
replacing the set of supplementary groups with a new
set.
-a -G ===== Append a user in Multiple Group
-d ===== Home DIR Specify a particular home directory for the user
account.
-m ===== Move Home Move the user's home directory to a new location.
Must
be used with the -d option.
-s ===== SHELL Specify a particular login shell for the user account
-l ===== Change The Login Name
-L ===== Lock The user Account
-U ===== Unlock The user Account
-u ===== Change the user ID
================================================================================
PRACTICALS:==========
=====: Change Login Name Syntex :- usermod -l <New Name> <Old Name>
Note:- The id command to show information about the currently logged-in user
================================================================================
Note:- You Can Add User in Secondary Gropu But When You Assign Linux1 User
into Another Group it Will Move From HR Group.
================================================================================
Options:=====
PRACTICALS:=====
Options:=====
PRACTICALS:=====
================================================================================
- Primary or Private
- Secondary or Supplementary
================================================================================
==========: Primary Group :==========
• The group which Created Manually by Root User to Add an Existing Users is
Called Secondary Group.
• User may a member of none or more supplementary group.
• Users are granted access to files based on whether any of their group
have access.
• Users of the supplementary members of local group are listed in last
field of /etc/group.
• User will be separated by comma in /etc/group
================================================================================
HR : x : 1007 : Tabrez,Parwez
❶ ❷ ❸ ❹
================================================================================
Options:=====
RACTICALS:==========
=====: Create Group GID Less Than 1000 Syntex :- groupadd -r <groupname>
Options:=====
RACTICALS:==========
=====: Changing Group Name Syntex :- groupmod -n <New Name> <Old Name>
Options:=====
RACTICALS:==========
=====: Add Multiple User in Group Syntex :- gpasswd -M <U1> <U2> <groupname>
================================================================================
Options:-
• You can use -d or --lastday option to modify the last password change date.
• The maximum number of days after which the password will expire. You
can change it using -M or --maxdays option. When the maximum days and
last password change date is less than the current date, the user will need
to change the password to use the account. The value -1 in this field
removes the password validity.
• The user will be warned before his/her password expiry date. To set or
modify the number of days of warning before a password expires, you can
use -W or --warndays option.
• You can use chage command without any options. It asks the users to enter
the value for all the fields. You can either enter a new value to change the
field or leave a blank to keep the current value. The current values are
displayed between [ ] brackets.
• To change the value in password expires, you have to modify the value in
maximum number of days between password change. If you put the value -
1 in it, it will set the password expires to never.
• In RHEL root is the super user, who have full access of the system.
• Root user can all commands without any restriction.
• This user managed the complete system administration.
• This user has the power to override normal privileges to local user
to perform some administer the system.
• The root user in Linux is almost like Administrator account in Windows.
• With the help of "su" Command You Can Switch Between the Users.
• If it is run by local user it will prompt for the password but if root
user invoke this command no password is required.
• The command su username starts a non-login shell, while the
command su - username starts a login shell
Sudo :=========
================================================================================
==================================Completed=====================================