User and Group Administration:
There are three type of user account in Red hat Linux
- Super user or Administrative account
- Regular user account
- service account
- Super User created automatically at the time of installation
- Regular user Account;
- Using command line method ‘useradd’ or ‘adduser’ command
- Graphical method by using Red hat user manager utility
a.
# adduser user_name (Recommended : minimum 6 character used in password)
# passwd user_name
Example:
#adduser Deepak
#passwd Deepak
Now open the file /etc/passwd to check the entry of user
#vi /etc/passwd
it contain 7 entry of each user
- Username
- Password
- userid
- groupid
- blank (User information field ) comment
- home directory
- login shell
password entry for each user will be stored in /etc/shadow
# vi /etc/shadow
now in order to check the Userid, Group we use /etc/login.def
# vi /etc/login.def
when any user account is created then user will get userid, groupid automatically from /etc/login.def
5th field is used for user information or comment
6th field is used for home directory. When any user is created its default home directory is created inside /home
/home/Deepak
7th field is login shell. Default shell for user is /bin/bash
different shells are used
ksh, sh, csh, tcsh,zsh
shell
is an user interface between user and O.S. linux command shell is a
prompt that allow us to interact with our system by executing various
command.
In order to check the shell available use /etc/shells
# vi /etc/shells
in order to get the information about the group we need /etc/group
#vi /etc/group
it contain four field
- Group name
- password
- GroupId
- Member of group
# finger : this command is used to get the information about the user
Syntax:
#finger username
#finger Deepak
#id : this command is used to get userid, groupid of the user
syntax:
#id username
#id Deepak
Creating Group:
Syntax:
#groupadd groupname
#groupadd –g gid groupname
Example:
#groupadd jeet
Exercise:
Create a user that should have uid=1000 shell=sh description and home directory as /data
Sol:
#useradd –u 1000 –c Deepakpundir –s /bin/sh –d /data Deepak
#passwd Deepak
Grpahically
System Setting :-> User & Group
OR
#system-config-user
Every user have two group one is elementary group or primary group and secondary group
-g : Primary Group
-G : Secondary Group
Creating Group
#groupadd g1
#groupadd g2
Steps:
1. adding group to the user
#usermod –g g1 –G g2 Deepak
2. To change id of the user
#usermod –u 1001 Deepak
3. change comment
#usermod –c Deepakmehra
4. change home directory
#usermod –d /Deepak-home Deepak –m
5. change shell
#usermod –s /bin/bash Deepak
6. change user login name
#usermod –l newname oldname
#usermod –l jeetesh Deepak
7. Change Group name
#groupmod –n newname oldname
#groupmod –n group1 g1
8. change Group id
#groupmod –g 2005 group1
Thanks,
Very informative post. Keep up the good work. I would really look forward to your other posts
ReplyDeleteDell - Inspiron 15.6" Touch-Screen Laptop - 4GB Memory - 500GB Hard Drive - Black (15RVT-9095BLK)
Dell - Latitude 14.1" Refurbished Laptop - 4GB Memory - 250GB Hard Drive - Gray
Very informative post. Keep up the good work. I would really look forward to your other posts
ReplyDeleteDell - Inspiron 15.6" Touch-Screen Laptop - 4GB Memory - 500GB Hard Drive - Black (15RVT-9095BLK)
Dell - Latitude 14.1" Refurbished Laptop - 4GB Memory - 250GB Hard Drive - Gray