User & Group Adminstration


User

1 : Show the details of all users
user -D

2 : To add new user in system
useradd name

3 : To delete particuler user from the group
userdel -r name

4 : usermod command is used for modifying user
eg:


If user want to insert comment then
usermod -c "comment" user name


5: To set the password on particuler user command will be
passwd username


Group Administration

1 : To add new group named projectX command will be
groupadd projectX


2 : To remove group named projectX command wil be
groupdel projectX


3 : To add user in a group
usermod -G <Group name> <username>


eg: To add username haktuts in a group name called projectX
usermod -G project X haktuts


4 : To add user in a multiple group
usermod -G <Group name><Group name> <username>


eg: To add username haktuts in a group name called projectX and project Y

usermod -G projectX,projectY haktuts


5 : How to provide admin right to specified user in a particuler group
gpasswd -A username groupname


6 : To add user in a group
gpasswd -a username groupname


7 : To remove group named projectX command wil be
gpasswd -d username groupname


8 :create new group called abcd
newgrp abcd

Note: User can be add in a group via usermod as well as gpasswd command

User and Group Databases file


1 : To check the all set password go to directory
cat /etc/passwd


2 : To see password which is set in encrypted form
cat /etc/shadow


3 : To check detail of all the group
cat /etc/group



How to Read the passwd file located in etc directory?


username:x:1000:1001::/home/username
username i.e name of user
x stands for password of user which is masked
1000 is the user id
1001 is the group id
:: user comment between collens
/home/username Home directory of user


How to Read the shadow file located in etc directory?

username:xyzxyzxyz:11111:0:9999:7:::
username i.e name of user
xyzxyzxyz stands for password of user which is masked or encrypted form
11111 stands for No.of days since 1970
0 stands for minimum no of days to change the password
9999 stands for max no of days to change the password
7 stands for warning period
Note Password is encrypted through data encryption standard or MD5 algorithm

Types of user

There are two types of user

1 System users
2 Normal users
id from 0-499 is reserved for system user and 500-60000 is for normal user.


© 2014 HaKTuts. All rights reserved.