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

无需chattr:设置局域网共享文件夹不可移动且保留rwx权限

How to Prevent Moving a Shared Folder While Keeping rwx Permissions

Alright, let's break this down. You've got a server with shared folders like Photos and Music, you can't delete the Photos folder but still move it within the Family Share scope, and you want to lock down that move capability while keeping full read-write-execute (rwx) access to the folder's contents. Here's how to do it based on your server's setup:

For Windows Servers (NTFS Volumes)

Since moving a folder within the same volume is essentially a rename operation (which modifies the parent directory's entries), we can tweak NTFS advanced permissions to block this while preserving rwx:

  • Right-click the Photos folder → Properties → Security tab → Advanced
  • Find the permission entry for your Family Share group and click Edit
  • In the Advanced Permissions list:
    • Keep these permissions enabled to maintain rwx access:
      • Read & Execute, List Folder Contents, Read
      • Write, Create files / write data, Create folders / append data
    • Uncheck Rename and Delete (these are what allow moving the folder within the share)
  • Click OK to save changes. Users can still edit, add, and run content inside Photos, but can't move or rename the folder itself.

For Linux Servers (Samba Shares)

Samba has built-in settings to lock specific folders from being moved, plus we can use ACLs to preserve rwx access:

  1. Tweak Samba Configuration
    • Edit your Samba config file (usually /etc/samba/smb.conf)
    • Find your Family Share section and add these lines:
      [FamilyShare]
         path = /path/to/your/shared/folder
         writable = yes
         valid users = @FamilyShare
         veto files = /Photos/  # Blocks moving/deleting the Photos folder
         delete veto files = no  # Ensures the folder isn't deleted accidentally
      
    • Restart the Samba service: sudo systemctl restart smbd
  2. Verify Folder Permissions
    • Make sure the Photos folder itself has rwx permissions for the group:
      chmod -R g+rwx /path/to/your/shared/folder/Photos
      setfacl -R -m g:FamilyShare:rwx /path/to/your/shared/folder/Photos
      
    Users will still have full access to the folder's contents, but can't move or rename the Photos folder within the share.

For macOS Servers (AFP/SMB Shares)

macOS lets you granularly control shared folder permissions via advanced settings:

  • Open System Settings → General → Sharing
  • Select your Family Share entry, then click Info next to it
  • Navigate to the Photos folder, right-click → Get Info → Sharing & Permissions
  • Click the lock icon to unlock, then click the gear icon → Show Advanced Permissions
  • For the Family Share group:
    • Keep Read, Write, and Execute enabled
    • Uncheck Rename and Delete
  • Make sure to apply these changes only to the folder itself (not recursively) so contents inside remain fully accessible.

Key Takeaway

Moving a folder within a shared area relies on modifying the parent directory's entries (to rename or reposition the folder). By blocking those specific permissions (rename/delete) at the parent or folder level, you lock the folder's position while keeping full access to what's inside.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 09:41:13