Linux Common Commands-user query __linux

Source: Internet
Author: User

A
Who: Query the current online users and sources;
Groups: Query the group to which the user belongs, groups query the group to which the current user belongs, and groups the user name to inquire about the group to which the user belongs;
ID: Query The current user's information;
Finger: Query The user's detailed information;

Two
Useradd: Create a user to create a group with the same name as the user;
passwd: Set the user's password;
Userdel: Delete User,-R can delete user's home directory;
Useradd-g Root Sunqiang: Creates a user and adds Sunqiang users to the root group. If you do not use the-G parameter, a group with the same name as the user is automatically established, and the-G parameter is used to specify the private group of the user, which is beneficial to the user's administration;
Usermod: Modify the user's information; usermod-g 503 change the user's GID to 503;
Usermod-l Sunqiang: Lock user Sunqiang, or add before/etc/shadow password. ;
Usermod-u Sunqiang: Unlock user Sunqiang, can also put/etc/shadow password before. Removal

Three
Groupadd: Create a group;
Groupadd Sqgroup: Create a group with a GID greater than 500;
Groupadd-r Sqgroup: Create a group with a GID less than 500;
Groupdel: Delete a group;
Groupmod: Modify the group information;
GROUPMOD-G 503 Sqgroup: The GID of the Sqgroup group was modified 503;
Groupmod-n newgroup Oldgroup: Modify the name of the group;
Gpasswd-a Sunqiang Root: Adds the user to the root group;
gpasswd-d Sunqiang Root: Removes the user from the root group;
Gpasswd-a Sunqiang Sqgroup: The Sunqiang user created is the administrator of the Sqgroup group;
Gpasswd-a Sunqiang "Sqgroup: Undo Sunqiang User is the administrator of group Sqgroup.

ID followed by the user name;
If we want to query the system in the user's UID and GID corresponding content, you can directly connect the user name, but the user name must be true, can be found in the/etc/passwd;
[Beinan@localhost ~]$ ID linuxer
uid=505 (linuxer) gid=502 (linuxer) groups=502 (Linuxer), 0 (Root), (Xu)
Note: Query the user linuxer information, the user Linuxer,uid 505, the attribution of the main user group is Linuxer, the main user group GID is 502, while the Linuxer user is also a GID 0 member of the root group, Also a GID is a member of the 500 user group Xu;

3, query login host user tools: W, who, users
W, WHO and the Users tool, is the user who has logged on to the current host, and finger-s can also query;

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.