当前位置:网站首页>RHCSA5

RHCSA5

2022-07-05 12:50:00 Grey rain

user 、 Group and sudo
Every user has a id Number
root Of uid Number is 0
uid 1-200 Users automatically created by the system
uid 201-999 Install third-party applications
uid 1000+ Other ordinary users created manually

/etc/passwd
Storage content
First column : user name
Second column :x( Originally password , Move back )
The third column :uid
The fourth column :gid
Followed by notes 、 Home directory 、 Login mode

Group
Each user belongs to a group , Defined as a collection of users

/etc/group
Storage content
First column : Group name
Second column :x( Originally password , Move back )
The third column :gid

obtain root jurisdiction
su Switching users , Temporary switching ,root No password is required for switching , The home directory doesn't change , I won't use the environment variables of new users
su - Switching users , Home directory transformation , Will use the environment variables of new users

sudo Raise the right
visudo To write
vim /etc/sudoers.d

visudo Specific operation
visudo
Cursor to end
 Insert picture description here
rewrite ,student Can perform all privileges
 Insert picture description here
rewrite ,student It can be executed useradd and su
 Insert picture description here
Log of execution

/var/log/secure

Create user
useradd
-d Specify home directory ( Home directory exists , Default home)
-e Specify expiration date
-g Appoint gid

tail -1 /etc/passwd

tail /etc/shadow
Random string ; password (hash), Creation time ( Days , The current date -1970.7.1); The password should be changed on the day when it is created ; Change the password for the number of days used ; Password expiration warning time

useradd No password , Use passwd To set the password

usermod
-u Group number user
-G Specify a new additional group
-a Specify to add an additional group
-L Lock the user , Unable to log in temporarily
-u user Unlock

groupadd Create group
groupmems
-d Delete a user of the Group -g The specified group

groupdel -r
userdel -r
-r Use as much as possible

chage The number of days to change the user's password

原网站

版权声明
本文为[Grey rain]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140524343324.html