linux-user and user group base commands and actions

Source: Internet
Author: User

linux-user and user group base commands and actions


    1. Adding users and user groups

      Add User: Useradd admin Add user called admin

    2. Add Group: Groupadd Admin Add user group

Delete User: Userdel admin Delete User

2. Viewing users and user groups

View User cat/etc/passwd

View Group Cat/etc/group

3. Modify user and user group properties

Modify User: Usermod

-U modifies UID information for the user

-G Modify User group information

User Group Management Groupadd

-G Custom Group ID

-R Add System group

Groupmod

-G Modify the group ID information

-N Fix the name of the group

Rights Management:

Chown: Change the owner of the file (only the administrator can fix it)

-R Modify the owner of the directory and internal files

Example: Chown admin /home/admins

CHGRP: The group to which the file is repaired (only Administrator-modified)

-R Recursive modification

Example: Chgrp admin/home/admins



To modify a file's permissions:

chmod permissions to modify files

-R Recursive modification

Example: chmod 777/home/admins

Add Special permissions: chmod

setuid: Sets the permission to have the file owner in the execution phase of the file. The typical file is/usr/bin/passwd. If the file is executed by an average user, the file can be rooted during execution so that the user's password can be changed.

setgid: This permission is valid only for the directory. After the directory is set, any user who creates the file in this directory has the same group as the group to which the directory belongs.

chmod g+s /home/admins to add markup to the directory

chmod u+s /home/admins to add markup to a file






This article is from the Computer knowledge blog, so be sure to keep this source http://huagongxiaodi.blog.51cto.com/10605602/1789739

linux-user and user group base commands and actions

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.