In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to quickly browse the basic user and user group management commands under Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Linux is a multi-user and multi-task time-sharing operating system. All users who want to use system resources must first apply for an account from the system administrator, and then enter the system as this account. On the one hand, users' accounts can help system administrators track users who use the system and control their access to system resources; on the other hand, they can also help users organize files and provide security protection for users. Each user account has a unique user name and user password. Users type the correct user name and password when logging in before they can enter the system and their own home directory.
To realize the management of user accounts, the main tasks to be completed are as follows:
a. Add, delete and modify user accounts.
b. Management of user passwords.
c. Management of user groups.
Management of Linux user account
The management of user accounts mainly involves the addition, deletion and modification of user accounts.
To add a user account is to create a new account in the system, and then assign resources such as user number, user group, home directory and login Shell to the new account. The account you just added is locked and cannot be used.
1. Create a new test1 user and set a password for that user
The code is as follows:
Adduser/useradd test1
Passwd test1
two。 New group1 user Group
The code is as follows:
Groupadd group1
Delete a group
The code is as follows:
Groupdel group1
Modify and reorganize
The code is as follows:
Groupmod-n group2 group1
Rename group1 to group2
3. Create a new test1 user and add to the group1 user group
The code is as follows:
Useradd-g test1 group1
4. Add workgroup group2 to existing test1 users
The code is as follows:
Usermod-G group2 test1
Or:
The code is as follows:
Gpasswd-a test1 group2
Usermod-d / home/test-G test2 test
Note: SHEL used by-g group-d home directory-s
Change the login directory of the test user to / home/test and join the test2 group. Notice that this is Big G.
The code is as follows:
Gpasswd-d test1 group2 removes user test1 from the group2 group
5. Temporarily close: add * before the second field (password) of the line belonging to the user in the / etc/shadow file
Just do it. If you want to restore the user, just remove *.
Or use the following command to close the user account:
The code is as follows:
Passwd peter-l
Re-release:
The code is as follows:
Passwd peter-u
6. Permanently delete user accounts
The code is as follows:
Userdel peter
Groupdel peter
Usermod-G peter peter
(force deletion of all files and subdirectories under the user's home directory and home directory)
7. Remove a user from a group
Edit / etc/group to find the line GROUP1 and delete A.
Or use orders.
The code is as follows:
Gpasswd-d A GROUP
This is the end of the content of "how to quickly browse the basic user and user group management commands under Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.