Users and Group
Users and Group Management
User – These are login
accounts through which we can access the features of an operating system
Group – It is a place where
users are placed to implement security, permissions and policies.
There are two type of users available in Linux
1) Root – It is the administrator account
2) Normal or Standard user – They are like restricted user standard
user \
If you logged through root “#” will appeared
If you are logged through normal user “$” will
appeared
There are total 69535 users can exist in a
Linux server
There are total 65535 groups we can create in a
Linux server
Point – In Linux background server
is known as demon services
Note – In Centos7 there are 0 to 999 users by
default you will get
Files Regarding Users & Groups
/etc/passwd – This five contains all the
information regarding users
/etc/shadow – This file contains
encrypted form of password
/etc/group – This file contains file regarding
group details
COMMANDS IN USER AND GROUP MANAGEMENT
S.no
|
Command
|
Work
|
1
|
useradd <new name>
|
To add a new user
|
2
|
groupadd<new name>
|
To add a new group
|
3
|
passwd <user name>
|
To set password to existing user
|
4
|
useradd –g <primary group> -G<secondary
group> <user name>
|
To create a new user with primary & secondary existing group
|
5
|
usermod –g <primary group> -G<secondary
group> <exiting user>
|
To add existing user in existing groups
|
6
|
usermod –l <user name >
|
Rename the existing user
|
7
|
userdel <user name >
|
To delete existing user
|
8
|
userdel –r < user name >
|
Delete existing user with all files
|
9
|
usermod –C <comment > <user name >
|
To implement comment name in user name
|
10
|
usermod –s /sbin/nologin <user name >
|
To make user no login
|
11
|
usermod –s /bin/bash <user name >
|
To make user enable
|
12
|
su -
<user name >
|
To Login with user
|
13
|
logout or exit
|
To exit from logged in user
|