Linux File Permissions inheritance

Source: Internet
Author: User



A low-privileged user generates a new file to a writable directory, and since the new file does not inherit the writable permission, the user cannot modify the operation of the file after the build.

Use the Setfacl command to automatically inherit the new file's permissions from the parent folder (-D parameter inheritance)



Setfacl-r-d-m u: User: rwx File/Folder





======================================================

Linux permissions inheritance, using Setfacl to divide permissions

Linux file permissions are classified as owner group other

Such as:

DRWXRWX---5 wdj wdj 4096 09-26 11:51 test

If the user soft want to have read and write access to the test directory, one is to add the soft user to the WDJ group. The other is to change other permissions to RW

If you want the files or directories under this directory to inherit permissions from the parent directory, you should chmod-r every time .... A bit


You can now use SETFACL to solve these problems

Setfacl-r-M u:soft:rwx test

Shell>ll

DRWXRWX---+ 5 wdj wdj 4096 09-26 11:51 test

This allows the soft user to manipulate the test directory

setfacl-d--set u:soft:rwx Test

-D is to have subdirectories inherit parent directory permissions


To view ACL permissions using the GETFACL command

[Email protected] data]$ GETFACL test

# File:test

# OWNER:WDJ

# GROUP:WDJ

User::rwx

User:soft:rwx

Group::rwx

Mask::rwx

Other::---

Default:user::rwx

Default:user:soft:rwx

Default:group::rwx

Default:mask::rwx

Default:other::---


Setfacl-x U:soft Test

Remove permissions for individual users


Setfacl-b Test

Delete the test directory so ACL permissions


Linux File Permissions inheritance

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.