Linux User and user group management

Source: Internet
Author: User

Linux is an excellent multi-user multitasking operating system.

Mastering Linux User/user group management is one of the basic and essential skills.

Simply make a summary.

Regardless of the user management settings of the graphical interface or the management of the terminal, the ultimate goal is to modify the user/user group configuration files of the system.

Therefore, we will manage the user/user group in a way that directly modifies the relevant configuration file.

  

First, we have to figure out how the system loads user/user group-related configuration information.

A friend of the Linux system file structure know clearly, the/etc/directory is centralized storage of Linux configuration files, here we do not say, focus on the core of this section, the user/user group management configuration file is also present here. What are the files?

/ETC/PASSWD &/etc/shadow-These two are the relevant profiles of user information;

/etc/group &/etc/gshadow--These two are the relevant configuration files of user group information;

passwd and group store basic record information, where the information is recorded in clear text, but the password can not be shown, so the information such as password is processed into the shadow and Gshadow files. Therefore, we are going to modify these four files to implement the management function.

  

User/user group management is no exception to the deletion and modification of these items. In this case, the record format in the file is not described in detail. Dry up ~ ~ ~

Check, there is nothing to say, with VI open, the naked eye to see also line, (:/) Search is OK, find their own needs of the record just.

Increased, is from scratch, management needs of the moral integrity here will come into contact. By following the constraints, we add new records.

1. User management, vi passwd, format--user name: X:uid:gid::home path:/bin/bash

2. The second field of X is the meaning of the password, but it has been mentioned that the password is not set in this file, we will do the projection processing of the file, terminal execution Pwconv,shadow will generate a record of the user name should be.

3. User group management, VI Group, format--user group name: x:gid:user_list

A user_list is a collection of users that the user group contains, separated by commas between multiple users. After you modify the user group information, add the delete user to the user group from here.

4. Project management of the group, the terminal executes the GRPCONV, and the record of the user group is generated in Gshadow.

5. Add a basic system configuration file for the new user. The premise is to prepare the home directory for the new user according to the configured home path, and then copy the hidden files under/etc/skel/to their home directory.

6. Modify the attribution of its home directory to the users and user groups configured in the configuration file.

OK, the first. Activates the new user, the terminal executes the passwd user name, sets the password for it.

In the above settings, it is important to note that the root user group operation should be cautious, do not add ordinary users. UID, the system will generally reserve space, ordinary users are generally located between the 1000~60000, GID is also, and do not repeat. During the add process, be aware that the Uid,gid set for it is already in use for reasonable modification.

Now that it's added, it's easier to change nature.

Delete operations, delete from passwd and shadow, and delete them within the corresponding group of user_list.

This is the author's own summary of the article, so there will be some content in the middle of the brief, if there is inappropriate, please advise, give correct. If a friend needs help, you can leave a message or send an email [email protected], the author will be as timely as possible to give a reply.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.