Get the App
SLTechnology News&Howtos  ›  Servers  › 

User Management under Linux

Shulou Source: shulou.com Published: 2022-06-02 07:56:51 09月10日 Update

1 the significance of the existence of users and user groups

The user is the identity of the operator in the system

A group is a logical concept and a collection of users

The existence of users in order to classify users to facilitate the management of permissions

two。 The way users are stored in the system

The user is the string in the file in the system.

Each string maps the system resources used by the user

3 View of user information

Id to view the id information of the specified user

The common argument of the id command-u view the user's uid-g view the user's gid-G view the id-n of all groups in which the user belongs to display names instead of id numbers

4 user identity switching mode and environment variables

Logout command in the drawin

Gnome-session-quit-- force logs out the current user

Su and su-

Su only switches user identities, not user environment su-switches user identities and user environments

Note: every time the su switches to another user action, you must exit, and then switch to another user again. When the advanced user switches to the low-level user, you don't need a password, and the low-level user switches to the advanced user without a password.

5. Establishment and deletion of users and user groups, information management of users and user groups useradd establishment of groupadduserdelgroupdel

User deletes userdel-r user

Common parameters of useradd

-u specify the user's uid-g specify the user's gid-G specify the user's additional group-c specify the user's description-d specify the user's home directory, default is / home/username-s specify the user's default shell

Groupmod-g

Usermod

-l modify user name-u modify user's uid-g modify user gid-aG modify user additional group-c modify user's description-md modify user's home directory, default is / home/username-s modify user's shell type

Suggestion: use monitoring commands in the course of the experiment to see the changes more intuitively

6 user authentication management and authentication content analysis

/ etc/shadow user authentication information file

Modify the password

1:2: 3:4: 5: 6: 7: 8:9

Passwd westos (ordinary user)

Passwd (Advanced user)

Echo linux | passwd-- stdin root changes the password of root user to linux

Name modification command modification command passwd -? chage1. User name 2. User password-L3. Password expiration time-e-d4. The shortest period of validity of the password-n-m5. The longest period of validity of the password-x-M6. Password expiration warning-wW7. Password inactive days-i-I8. Password expiration date-E9. Reserved, unset bit

User authentication management

Tags: User password switch command management information user group system identity authentication advanced environment low-level valid parameter name character string commonly used file Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei OPPO Reno Redmi macOS Apple