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

معمل 7.2RHCSA 10, الفصل 7

Defaults, ACLs and fixing access problems

المستوى
متوسط
35 دقيقة
الأجهزة
server1
الحالة
لم يبدأ

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

الهدف

Set safer default permissions, give one extra group access with an ACL, protect a file, and fix a broken access path.

قبل أن تبدأ

  • Finish lab 7.1 first. Work on server1 as root unless a task says otherwise.

المهام

  1. For user anna only, new files must get 640 and new folders 750.
  2. Members of account must be able to read (not change) everything in /data/sales, also files that are created later.
  3. User carol (not in any team) must be able to read /data/sales/bob.txt only.
  4. Make /data/sales/bob.txt immutable, try to delete it as root, then remove the protection again.
  5. Run chmod 700 /data (a "mistake"). As anna, try to open /data/sales. Find the cause with namei -l and fix it so that the team folders work again and others still cannot list /data.

تحقّق من عملك

su - anna -c 'umask; touch /tmp/x1; mkdir /tmp/x2; ls -ld /tmp/x1 /tmp/x2'
getfacl /data/sales
su - bob -c 'echo test > /data/sales/new.txt'; getfacl /data/sales/new.txt
su - carol -c 'cat /data/sales/bob.txt'
ls -ld /data; lsattr /data/sales/bob.txt
  • anna: umask 0027, file -rw-r-----, folder drwxr-x---.
  • /data/sales has group:account:r-x and default:group:account:r-x; new.txt has group:account:r-- (effective).
  • carol can read bob.txt.
  • /data is drwx--x--x (or 711); bob.txt has no i attribute.

تلميحات

اعرض التلميحات
  • One user: ~/.bashrc. All users: /etc/profile.d/.
  • Default ACL: setfacl -d -m. Use rX so folders get x and files do not.
  • carol needs x on /data/sales to reach the file, and r on the file. setfacl -m u:carol:x on the folder is enough for the path.
  • chmod 711 /data lets everybody pass through without listing.

الحل

اعرض الحل
  1. umask for anna.
    echo "umask 027" >> /home/anna/.bashrc
  2. Normal and default ACL for the group account.
    setfacl -R -m g:account:rX /data/sales
    setfacl -d -m g:account:rX /data/sales
  3. Path and file for carol.
    setfacl -m u:carol:x /data/sales
    setfacl -m u:carol:r /data/sales/bob.txt
  4. Immutable test.
    chattr +i /data/sales/bob.txt
    rm -f /data/sales/bob.txt
    rm: cannot remove '/data/sales/bob.txt': Operation not permitted
    chattr -i /data/sales/bob.txt
  5. Find and fix the path problem.
    chmod 700 /data
    su - anna -c 'namei -l /data/sales'
    chmod 711 /data

ملاحظاتي

لا توجد ملاحظات بعد.

دروس هذا المعمل

الأوامر في هذا المعمل