当前位置:网站首页>Account command and account authority
Account command and account authority
2022-06-30 07:29:00 【My deep blue】
Account command and account authority
Account base command
- Display host name
hostname
// Change host name
hostname abc
- Check the current location
pwd
- View user login information
who
- User login details
w
- View current account
whoami
- View system time 、linux The elapsed time 、 Number of users 、 Load condition
uptime
- View the current account UID \ GID
id
- Switch accounts
The administrator can directly switch to the general account , Common account needs password to switch to administrator
1.su Account name
2.su Default switch administrator
- Add account
useradd Account name
Parameters
-u: Set up UID
-g: Set primary group
-G: Set the group to be affiliated
-C: Set the user instructions
-d: Specify user home directory
-S: Designated user shell
-e: Account expiration date , The format is : YYYY-MM-DD
-f: Specifies whether the password is invalid ,0 Indicates immediate failure ,1 It means never to fail
Used useradd after , The following operations will be performed by default
1、 stay /etc/passwd Next Establish relevant information
2、 stay /etc/shadow Write the relevant parameters of the password
3、 stay /etc/group Write in Enter a group with the same account name
4、 stay /home Create the user's home directory under
- Delete account
userdel Account name
Parameters
-r: Delete along with home directory and email
To completely delete an account , step :
1、 Delete /etc/passwd;/etc/shadow Contents of the file
2、 Delete /etc/group;/etc/gshadow
3、 Delete /home/username;/var/spool/ mail/username
4、 Delete the user who has been to this Liunx Files created in ,find To search , In the use of userdel
- Modify account information
usermod
Parameters
-C: Account description
-d: Modify home directory
-g: Modify the primary group
-G: Modify affiliate group
-a: And -G- - Start using , Add affiliate groups
-l: Change user name
-U: modify UID
-L: Frozen account
-U: thaw
- Set the password
passwd password
Parameters
-l: Lock the account / Also available at /etc/shadow in Add... To the place where you put the password !
-U: Unlock
-S: Display the password parameters of the account
-n: Number of days to go , Set how long you can not change your password .
-X: Number of days to go , Set how long the password must be changed
-W: Number of days to go , Set the number of warning days before password expiration
-i: Number of days to go , Set password expiration days
- Set the time related parameters of the password
chage
Parameters
-L: View the time parameters related to an account and password
-d:YYYY-MM-DD, Change the time when the password was last changed
-E:YYYY-MM-DD, Modify the expiration time of the account
-l: Days , The password will expire after a few days
-m: Days , Set the password for at least a few days ,
-M: Days , How long after setting the password , You need to update
-W: Days , Set the warning time before password expiration
Little knowledge
chage -d 0 Account name //-d Back plus 0 , The purpose is to force you to change your password when you log in to this account for the first time , This password must conform to the complexity specification ( Capitalization 、 A lowercase letter 、 Numbers 、 character )
Account on disk
Account and group name : People see it
UID and GID::Linux see Of
id: View the currently logged in user's UID and GID
When we use Is -I When , The system will /etc/passwd and /etc/ group The content of the document , find UID and GID The corresponding name
- /etc/passwd: Recorded Linux All accounts on
- /etc/shadow: The password corresponding to the account is recorded
- /etc/group: All groups are recorded
- /etc/passwd

- 123: user name
- X: In the early part of this section, the user login password , Now the password is put in /etc/shadow It's in
- UID: 0 Indicates that the system administrator ,1-999 Protect Reserved for the system ID,1000 With For general users
- GID:0 Indicates that the system administrator ,1-999 Protect Reserved for the system ID,1000 With , For general users
- Lewis: User information description ,/home/lewis: User home directory , When logging in , directory /bin/bash, When the user logs in , Whether it can be used shell, If you can't use shell, Is displayed /sbin/ nologin
- /etc/shadow

- 123: Use the corpse name
- A string of red characters : Encrypted password .
- Date of last password change :Linux Date in , It's through 1970 year 1 month 1 The date on which the accumulation begins
- The number of days that the password cannot be changed :0 It means that it can be modified at any time
- The number of days that the password needs to be changed again : By modifying the value , You can force users to change passwords
- Number of alarm days for password change :7 The system will send an alarm to the user within days
- After password expiration , How long can the account still be used
- Account expiration date : adopt 1970 year 1 month 1 The date on which the accumulation begins , When it's time , Whether or not the password has expired , The account can no longer be used
- Retain
- /etc/group

- Lewis: Group name
- X: Set the password , In general, you don't need
- 1000:GID
- Affiliate group , These documents are not recommended to be modified directly , It is recommended to use the command to modify .
边栏推荐
- The first up Master of station B paid to watch the video still came! Price "Persuading" netizens
- 解决:div获取不到键盘事件
- Introduction to go project directory structure
- 网络安全-ARP协议和防御
- QT msvc2015 compiler reports an error: error: lnk1158: unable to run "rc.exe"
- Raspberry pie 4B Getting Started Guide
- Network security - routing principle
- Error reporting record
- 期末複習-PHP學習筆記6-字符串處理
- 03 - programming framework: Division of application layer, middle layer and driver layer in bare metal programming
猜你喜欢

神经网络计算量及参数量

The maximum expression in Oracle database message list is 1000 error
![Experiment 1: comprehensive experiment [process on]](/img/19/6c6e18d7e1f042bfd3ee4832b78542.png)
Experiment 1: comprehensive experiment [process on]

nRF52832 GPIO LED

Final review -php learning notes 11-php-pdo database abstraction layer

Network security - packet capture and IP packet header analysis

期末複習-PHP學習筆記6-字符串處理

Ad\dxp how to solve the problem of not knowing the schematic Library

期末复习-PHP学习笔记11-PHP-PDO数据库抽象层.

C51 minimum system board infrared remote control LED light on and off
随机推荐
Embedded test process
next InitializeSecurityContext failed: Unknown error (0x80092012) - 吊销功能无法检查证书是否吊销。
Similarities and differences of differential signal, common mode signal and single ended signal (2022.2.14)
Idea running run and services
[solved] failed! Error: Unknown error 1130
Introduction to ecostruxure (1) IEC61499 new scheme
解决:div获取不到键盘事件
C language implementation of chain stack (without leading node)
Private method of single test calling object
Grep command usage
线程池——C语言
STM32 control LED lamp
Write and run the first go language program
Swiftui creates a beautiful custom press feedback button
Video player (I): process
uniapp图片下方加标签标图片
JS create PDF file
1285_ Expand macros defined by AUTOSAR functions and variables with scripts to improve readability
Matter protocol
期末复习-PHP学习笔记11-PHP-PDO数据库抽象层.