User Management
Linux system is a multi-user multi-tasking operating system, a user want to use any system resources, must first apply for a user account to the system administrator, and then enter the system as a user of this account; at least Linux users to belong A group.
-
Add user
-
useradd [-d] bcxtm
, Add the user account of bcxtm (default/home/bcxtm
) ,,-d
add to the specified directoryIf the group to which the new user belongs is not specified, a group consistent with the user name will be created by default
-
-
Assign/modify password
passwd bcxtm
, Interactively set the password, only the root user has this authority
-
delete users
userdel [-r] bcxtm
, Delete the user account of bcxtm, keep the user directory,,-r
cascade to delete the user directory
-
Query user information
id bcxtm
Displayeduid
,gid
,所在组别名称
-
Switch user
-
su - bcxtm
, Usedsu -
by non-root users , switch users as an administratorNo password verification is required to switch from high authority to low authority, and vice versa; use exit to switch to the original user.
-
-
User group (similar to the concept of role, common users belong to a group)
- Add group:
groupadd groupName
- Delete group:
groupdel groupName
- Specify the group when creating a user:
useradd -g groupName userName
- Modify user group:
usermod -g newGroupName userName
- User and group relationship configuration storage
- User profile:
/etc/passwd
- Username: Password: User Identification Number: Group Identification Number: Annotative Description: Home Directory: Login Shell
- Group configuration file:
/etc/group
- Group name: Password: Group identification number: List of users in the group
- Password (encrypted login and password information) configuration file:
/etc/shadow
- Username: encrypted password: last modification time: minimum time interval: maximum time interval: warning time: inactivity time: expiration time: sign
- User profile:
- Add group:
Practical instructions
-
Run level concept (configuration file in
/etc/inittab
)0
: Shut down1
: Single user2
: Multi-user no network service3
:Multiple users have network services (commonly used)4
: System reserved5
: Graphical interface (commonly used)6
: Restart
-
Specify run level
init [0-6]
-
How to retrieve root password?
Enter single-user mode (login without a password), just change the root user password!
-
Help instruction
man
+指令
help
+指令