Management of Linux users and user groups

Source: Internet
Author: User

Account: 1. You can log into the operating system
2. Access control can be performed (different user permissions differ)

Group accounts: Easy to manage user accounts (permissions)
User account and group account unique identifier: UID GID
Administrator UID is 0
Group accounts: Basic group additional groups (public groups, subordinate groups)

Add Users:
useradd [Options] User
Common Command options:-u user ID
-D Home Directory path
-S Login Shell
-G Basic Group
-G Additional Group

grep ' Zhangsan '/etc/passwd user basic information
Zhangsan:x:1002:1002::/home/zahngsan:/bin/bash
User name: Password placeholder: uid:gid: User's description: Home directory: Interpreter
Example: Useradd-s/sbin/nologin Lisi Specifies the interpreter (if the user
Interpreter is/sbin/nologin and cannot be logged into the operating system)
Useradd-u 1100 WANG Specifies UID

User password Information Store address/etc/shadow file
passwd command: echo password | passwd--stdin User name free interactive
Temporary Switch User identity command: Su-user name

To modify user properties:
usermod [Options] User
Common Command options:
-U User ID
-D Home Directory path
-S Login Shell
-G Basic Group
-G Additional Group
Example: Usermod-u 1200-d/opt/tset-s/sbin/nologin Lisi

To delete a user:
Userdel User name (delete home directory)

Add Group: Group basic information is stored in the/etc/group file
head-1 | /etc/group
root:x:0
Group name: Password placeholder: GID: Group member list
Groupadd hihi (add ' Hihi ' group)

GPASSWD command: Add user to Group
GPASSWD-A User Name Group name (add)
GPASSWD-D User Name Group name (remove user from Group)
GPASSWD-M User name + user name: Group name (multiple users can be added at the same time)
Example: Gpasswd-m ' Zhangsan,lisi,wang ' hihi (add multiple users to the ' Hihi ' group)

Gropdel: Deleting a group user
Example: Group Hihi (delete "Hihi")


Management of Linux users and user groups

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.