Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Learning Notebook-Linux user Management

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Common command

Useradd: new users (root)

Userdel: delete user (root)

Groupadd: new user group (root)

Groupdel: delete user group (root)

Passwd: add / modify user password (root)

Chmod: assign file permissions (root)

Pwd: view current path (absolute path)

Vim / etc/passwd: view the roster of all users (owner everyone)

Vim / etc/group: view the roster of all user groups (owner everyone)

Vim / etc/shadow: stores the user's password encryption string (root)

When adding a new user, after entering a legitimate command, the command line does not report an error, and generally speaking, the addition is considered to be successful. You can check all user confirmations. Linux recommends that user names generally start with lowercase letters or underscores, use lowercase letters or numbers as far as possible (add a "-", some people say no, but my test is available), no more than 8 characters in length, case-sensitive. Chinese is certainly not good, pure numbers can still be 000mm 999 (feel the same as × ×, unlucky). There are other restrictions, slightly.

When you delete a user, userdel xxx. Prompt: user xxx is currently logged in (user logged in! ) can not be deleted.

File permissions. It is generally represented by three digits, up to 777. If the character representation is used, refer to the following figure

Highest position: user; intermediate position: group; lowest position: others

Readable (r) attribute value: 4, writable (w) attribute value: 2, executable (x) attribute value: 1. If there is no permission, it will be represented by "-", and finally the sum operation will get the result.

(note: the picture is from "Bird Linux Private Cuisine")

Path

Absolute path: contains the full directory, starting with "/".

Relative path: relative to the path in the current directory, with "." Or ".. /". ".. /" means a directory at the next level.

Interpretation of key user information / etc/passwd (roster suggests vim to open, color distinction is more comfortable. "roster" is my own pronoun, and it does look colorful)

Registration name: password: user identification number: group identification number: user name: user home directory: command interpreter

Such as: waka:x:1002:1002::/home/waka:/bin/sh

Then correspond to:

Registration name (login_name): waka (the name from which useradd is used)

Password (passwd): X (saved under / etc/shadow, there is no rush to use vim to check it, it is full of encrypted Saturn)

User identification number (UID): 1002 (similar to × × number, unique in the system. You can have an alias, a used name (registration name), but the × × × number is always unique (UID); the UID and GID of root are 0, and the big BOSS is different. 199 is reserved for cadres, and we wait for the grass-roots people to start at 100. Why does the online information say that the linux limit is 500, but I am 1002 here? )

Group identification number (GID): 1002 ("group" is similar to a club in a school. You (registration number) can join several clubs (groups) at the same time, but the group is unique.)

User name (user_name): (empty) contains some information about the user (that is, some descriptive information). It is easier to confuse the word "user_name" than to use "remark". It is estimated that the crooked people have their own ideas, but they are of little use anyway.

User home directory (home_directory): / home/waka (is it possible to compare the Administrator directory under win,my document to the root directory, while the other user directories are called user home directories here? However, why can't you display the files in the home directory through ls / home/waka? The system prompt does not exist? And cannot mkdir, prompt permission is not enough?)

Command interpreter (Shell): / bin/sh (the full path name of the Shell program. The file system defaults to sh (BourneShell). It will change if you use another shell path to point.

User password Management File / etc/shadow

Login name: encrypted password: last modified time: minimum time interval: maximum time interval: warning time: inactivity time: failure time: flag

Encrypted password: if it is an asterisk, the account is locked. There are a variety of encryption methods, there is no need not to repeat.

Last modified time: on my unbantu system, the time starting point was January 1, 1970. Unit: days.

There is also a bunch of parameters that are used less than are skipped and checked again when needed. Don't worry! "man shadow" is always with you.

There is doubt to be answered:

How do I know who is currently logged in if the prompt only shows "$"?

How do I view the details of the currently logged in user?

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report