Skip to main content

ACL

  • subject
    • owner - u
    • group - g
    • other - o
    • all - a
  • perm
    • read - r
    • write - w
    • execute - x
    • sticky - t - 1
      • 限定 owner 才能操作
    • setgid,setuid - s - 2,4
  • 2755
    • 1 - sticky bit
    • 2 - setgid
    • 4 - setuid
bitsnamefor
04000S_ISUIDsetuid
02000S_ISGIDsetgid
01000S_ISVTXsticky bit
stat -c '%A %a %n' *

mkdir dir
chmod 0755 dir
chmod 00755 dir # 会移除 flag - sgid, suid

stat -c "%a %U:%G %n" dir
stat -c "%U:%G %n" dir

acl fix

find . -type d -a -not -perm 0755 -exec chmod 0755 {} \;
find . -type f -a -not -perm 0644 -exec chmod 0644 {} \;

# 修改用户
# 目录 root -> admin
sudo find . -type d -user root -exec chown admin {} \;
# 找到非 admin
sudo find . -not -user admin -exec chown admin {} \;