You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Linux Mint中文件与文件夹权限无法继承问题求助

Fixing Inheritance of 775 Group Permissions for New Files/Folders on ext4 (ACL Enabled)

Hey there, let's work through this permission issue you're hitting on your Linux Mint system. You've tried setfacl and adjusting umask, but new files still default to 644 instead of inheriting the 775 group permissions you need. Let's break this down step by step to get it working right.

1. First: Verify ACL is Properly Enabled on Your Filesystem

Before diving into permission rules, make sure your ext4 partition actually has ACL support turned on—this is a prerequisite for any ACL settings to take effect:

  • Run this command to check current mount options:

    mount | grep ext4
    

    Look for the acl keyword in the output (e.g., rw,relatime,acl). If it's missing, you need to update your /etc/fstab file:

    • Open /etc/fstab in a text editor, find your ext4 partition line, and add acl to the mount options list (separated by commas).
    • Remount the partition to apply changes: sudo mount -o remount / (replace / with your actual mount point if it's a different partition).
  • To confirm it's set permanently for future boots, run:

    tune2fs -l /dev/your-partition-device | grep "Default mount options"
    

    You should see acl listed here.

2. Correct the Default ACL Configuration

Your initial setfacl -R -d -m ugo:rwx command is syntactically valid, but it misses a critical component: setting the mask permission, which acts as a filter for group and other user permissions. Here's the correct workflow:

Step 1: Set the Parent Folder's Base Permissions

First, ensure the target folder itself has the 775 permissions we want to inherit from:

sudo chmod 775 /path/to/your/target/folder

Step 2: Apply the Default ACL Rules

Default ACLs dictate what permissions new files/folders inherit. We'll explicitly set permissions for the owner, group, others, and the mask to ensure group permissions aren't restricted:

# Set default permissions: owner rwx, group rwx, others rx
sudo setfacl -d -m u::rwx,g::rwx,o::rx /path/to/your/target/folder
# Set the mask to rwx to ensure group permissions are fully applied
sudo setfacl -d -m m::rwx /path/to/your/target/folder

The -d flag marks these as default rules, meaning they'll apply to all new items created inside the folder.

Step 3: Verify the ACL Setup

Run this command to check that your default rules are correctly applied:

getfacl /path/to/your/target/folder

You should see output that includes these default rules:

default:user::rwx
default:group::rwx
default:other::r-x
default:mask::rwx

3. Ensure Your umask Setting is Active

Changing umask to 0002 is the right move for group-friendly permissions, but make sure it's permanently set:

  • For your user account, add umask 0002 to the end of your ~/.bashrc file.
  • For all users system-wide, add it to /etc/profile or /etc/bash.bashrc.
  • Apply the change immediately with source ~/.bashrc (or the system-wide file you edited), and log out/in to ensure it's active for all sessions.

Note: When default ACLs are in place, they take priority over umask, but setting umask 0002 ensures consistency across your system even outside this specific folder.

4. Test the Results

Now create a test folder and file to verify permissions:

cd /path/to/your/target/folder
mkdir test_dir
touch test_file
  • The folder test_dir should show permissions drwxrwxr-x (775)
  • The file test_file will show -rw-rw-r-- (664) — this is normal! New files don't get execute permissions by default (a security safeguard). If you truly need executable files to inherit 775, you can adjust the default ACL, but this isn't recommended for most use cases.

内容的提问来源于stack exchange,提问作者user313162

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 07:55:20