الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

getfacl

Show the access control lists (ACLs) of files and directories.

المستوى
لينكس اليومي
المجموعة
الصلاحيات
يحتاج root
لا
الحزمة
acl

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

getfacl shows the owner, group and normal permissions plus the extra ACL entries: rights for named users and groups, the mask, and default entries that new files inherit. A + after the mode in ls -l tells you a file has an ACL.

The output format can be used to restore ACLs with setfacl --restore.

طريقة الكتابة

getfacl [-aceEsRLPtpndvh] FILE...

الخيارات 14

الأكثر استخدامًا

-a, --access
Show only the access ACL.
-d, --default
Show only the default ACL.
-c, --omit-header
Do not show the comment lines (file, owner, group).
-e, --all-effective
Show the effective rights of all entries.
-E, --no-effective
Do not show effective rights.
-s, --skip-base
Skip files that have only the normal permissions.
-R, --recursive
List the whole tree.
-L, --logical
Follow symbolic links to directories.
-P, --physical
Do not follow symbolic links.
-t, --tabular
Show a table.
-p, --absolute-names
Keep the leading / in names.
-n, --numeric
Show UIDs and GIDs as numbers.
-v, --version
Show the version.
-h, --help
Show help.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع sudo)

  1. 1Show the ACL of a folder

    getfacl /srv/sales
    # file: srv/sales
    # owner: root
    # group: sales
    # flags: -st
    user::rwx
    user:carol:r-x
    group::rwx
    group:account:r-x
    mask::rwx
    other::---
    default:user::rwx
    default:group::rwx
    default:group:account:r-x
    default:mask::rwx
    default:other::---

    flags -st = SGID and sticky; default lines are for new files.

  2. 2See which files have an ACL

    ls -l /srv/sales
    drwxrws--T+ 2 root sales 22 Oct 25 11:00 /srv/sales

    The + means an ACL.

  3. 3Only the extra entries

    getfacl -cs /srv/sales/*

    Skips files without ACL and the header.

  4. 4Effective rights after the mask

    getfacl /srv/sales/new.txt
    group:account:r-x		#effective:r--

    The mask removes x: account can only read.

  5. 5Back up all ACLs of a tree

    getfacl -R /srv > /root/srv-acl.txt

    Restore with setfacl --restore=/root/srv-acl.txt.

  6. 6Only the default ACL

    getfacl -d /srv/sales

    What new files will get.

  7. 7Copy an ACL to another file

    getfacl plan.txt | setfacl --set-file=- report.txt

    Same ACL on report.txt.

  8. 8Numbers instead of names

    getfacl -n /srv/restore

    Helps when users from another server do not exist here.

  9. 9Audit folders with extra access (security)

    getfacl -R -s -p /srv 2>/dev/null | grep -E '^(# file|user:|group:)'

    Lists who got extra rights beyond the normal mode.

  10. 10Table view

    getfacl -t /srv/sales

    Access and default in columns.

انتبه

  • cp and mv keep ACLs only with cp -a (or --preserve=all); tar needs --acls.

رموز الخروج

0 :: Done. 1 :: Error.

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man getfacl