In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The roles of Linux users are identified by UID and GID.
UID user ID: equivalent to a separate ID card, which is unique in the system
GID group ID: equivalent to your own family or your school.
1. The commands for creating a user and setting a password are as follows:
Useradd [parameter] user name
-g genus group
-u set uid
-m create home directory
-M has no home directory
-G specifies that it belongs to multiple groups
-s specifies login shell
-d specify home directory
-c comment
-D change its default properties
-e the date specified is the date on which the account expires
You can man useradd in xshell.
Examples are as follows:
Useradd-c "admin"-m abc
Explanation: create an ordinary abc user with a comment "admin" and automatically create a home directory.
2. Use the passwd command to set the password and modify the user password for the new user:
Passwd parameter user name
-l: lock the name of the named account
-u: unlock the account lock status
-x,-- maximum=DAYS: maximum password usage time (days)
-n,-- minimum=DAYS: minimum password usage time (days)
-d: delete the user's password
-S: check the password authentication type of the specified user
-- stdin: non-interactive change / set password. The disadvantage is that the operation log can check the password and kill it with history-c.
Example:
Passwd user name echo 123345 | passwd-- stdin user name
Note: when we delete a user's password, we do not need a password to log in.
3. Modify the user:
Usermod parameter user name
-c: modify the remarks of the user's account.
-d: modify the directory when the user logs in.
-e: modify the validity period of the account.
-f: change the number of days after the password expires to close the account.
-g: modify the group to which the user belongs.
-G: modify the additional group to which the user belongs.
-l: modify the user account name.
-L: locks the user's password so that the password is invalid.
-s: modify the shell used by users after logging in.
-u: modify the user ID.
-U: unlock the password.
Common parameters include-c,-d,-m,-g,-G,-s,-u, and-o, which, like the options in the useradd command, can specify a new resource value for the user.
Examples are as follows:
The common option for the user name of the userdel parameter is-r, which deletes the user's home directory together. Userdel-r abc
5. Create a user group:
Groupadd parameter user group name
-g: specify the gid of the new user group
-r: create a system workgroup. The group ID of the system user is less than 500mm.
-K: overwrite the configuration file "/ ect/login.defs"
-o: allows you to add workgroups whose group ID number is not unique.
Example:
Groupadd-g 344 bqh
Explanation: create a bqh group with an id of 344.
6. Reorganize:
Groupmod parameter user group name
-g: GID specifies a new group identification number for the user group.
-o: when used in conjunction with the-g option, the new GID of the user group can be the same as the GID of the existing user group on the system.
-n: new user group changes the name of the user group to a new name
Example:
Groupmod-g 356-n bqh2 bqh
Explanation: change the name of the user group bqh to bqh2, and the group gid to 356.
7. Delete a user group:
Groupdel user name
Example:
Groupdel bqh2
User query related commands:
Id / / query user information, such as which user group the user belongs to, and uid and gid, etc.
W / / to see who has logged in and what has been done, the switch is not good, only if you log in again.
Who / / check which users are logging in, terminal and login time, source host.
Users / / only shows which users are logged in.
Last / / shows a list of users who have logged in and logged out
Last log / / you can check whether any users have logged in to the system (accounts that are not enabled)
Original address: https://www.linuxprobe.com/linux-creat-group.html
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.