Ravindra BagaleCourses & study guides English

Linux ACL आणि File Attributes: setfacl, getfacl, chattr आणि lsattr उदाहरणांसह

साध्या permissions एक owner, एक group आणि बाकी सगळ्यांना rights देतात. कधी जास्त हवं: एका extra user ला read, किंवा एकाच folder वर दोन teams ना वेगळे rights. ACLs (Access Control Lists) ते करतात. File attributes (chattr) आणखी एक layer: file immutable करता येते म्हणजे root पण बदलू शकत नाही, किंवा logs साठी append-only.

या chapter मध्ये तुम्ही काय शिकाल

  • ACLs कधी लागतात ते ओळखा
  • getfacl ने ACLs वाचा आणि ls -l मधला + ओळखा
  • setfacl ने ACLs add, बदला, काढा
  • Default ACLs आणि mask समजा
  • Copy, backup, restore मधे ACLs ठेवा
  • lsattr आणि chattr +i / +a

1. रोजचं उदाहरण: society चा notice room

हे का लागतं?

कोथरूडच्या society मधे office room secretary आणि committee ची. Plumber ला मंगळवारी आत जायचं असतं, पण तो committee मधे नाही. त्याला committee मधे घालण्याऐवजी secretary दारावरच्या special list वर त्याचं नाव लिहितो: 'Plumber: आत येऊ शकतो, files ला हात नाही'. Society rule book laminate करून काचेत lock: काच उघडेपर्यंत कोणीही, secretary पण, बदलू शकत नाही. Visitor register मधे फक्त नव्या lines; जुन्या lines खोडता येत नाहीत.

हे काय आहे?

Owner आणि group = secretary आणि committee. दारावरची special list = ACL. 'आत येऊ शकतो, हात नाही' = एका user ला r-x. Lock काच = chattr +i (immutable). Visitor register = chattr +a (append-only).

कसं करायचं (step by step)

ACL असलेली file Linux कशी तपासतोProcess owner? Owner bitsत्याच्यासाठी named user entry? ती, mask च्या मर्यादेतGroup किंवा named group match? सर्वात चांगली, mask च्या मर्यादेतनाहीतर other bitsमग attributes: +i सगळे बदल थांबवतो, +a फक्त appendशेवटी SELinux/AppArmor अजून नाही म्हणू शकतात
Named users आणि सगळ्या groups साठी mask हे छत.

2. ACLs का: owner/group/other च्या मर्यादा

हे का लागतं?

File ला एकच group. Finance ला read आणि audit ला read-write एकाच folder वर हवं असेल तर साध्या bits ने गोंधळाच्या groups शिवाय जमत नाही.

हे काय आहे?

ACLs extra entries जोडतात: user:NAME:rwx आणि group:NAME:rwx, आणि mask आणि नव्या files साठी defaults. ext4, XFS आणि बहुतेक modern file systems वर चालतात (acl ने mount, जो default). ls -l mode च्या शेवटी + म्हणजे ACL आहे.

कसं करायचं (step by step)

  1. ACL ओळखा.
ls -ld /srv/reports

Output:

drwxrwx---+ 2 ravi finance 4096 Oct 25 /srv/reports

याचा अर्थ: + म्हणजे 9 bits पेक्षा जास्त आहे.

  1. Tool install आहे का?
command -v setfacl getfacl || sudo dnf install -y acl

Output:

/usr/bin/setfacl
/usr/bin/getfacl

याचा अर्थ: Package नाव acl.

3. getfacl: ACL वाचा

हे का लागतं?

Access बदलण्या किंवा debug करण्याआधी mask सह प्रत्येक entry बघायला हवी.

हे काय आहे?

getfacl FILE owner, group, मग user::, user:NAME:, group::, group:NAME:, mask::, other::, आणि folders साठी default: lines. '#effective:' mask ने कापलेले rights. -R tree. -c header लपवतो.

कसं करायचं (step by step)

  1. Folder ACL वाचा.
getfacl /srv/reports

Output:

# file: srv/reports
# owner: ravi
# group: finance
user::rwx
user:priya:r-x
group::rwx
group:audit:rwx
mask::rwx
other::---

याचा अर्थ: priya वाचू शकते, audit लिहू शकतो.

  1. Header शिवाय.
getfacl -c /srv/reports/q3.csv

Output:

user::rw-
user:priya:r--
group::r--
mask::r--
other::---

याचा अर्थ: छोटं, compare सोपं.

  1. Mask ने कापलेला right.
getfacl -c data.csv | grep effective

Output:

user:sam:rw-		#effective:r--

याचा अर्थ: sam चा w mask ने block.

4. setfacl -m: entry add किंवा बदला

हे का लागतं?

Owner, group किंवा other bits न बदलता आणखी एका व्यक्ती किंवा team ला access.

हे काय आहे?

User साठी setfacl -m u:NAME:rwx FILE, group साठी -m g:NAME:rx, others साठी -m o::-. Commas ने एकदम अनेक. Tree साठी -R (फक्त folders ला x साठी X). Mask आपोआप update.

कसं करायचं (step by step)

  1. priya ला एक file वाचू द्या.
setfacl -m u:priya:r q3.csv && getfacl -c q3.csv | grep priya

Output:

user:priya:r--

याचा अर्थ: Group बदल नको.

  1. Audit team ला write.
setfacl -m g:audit:rw q3.csv && ls -l q3.csv

Output:

-rw-rw----+ 1 ravi finance 9K Oct 25 q3.csv

याचा अर्थ: दिसणारे group bits आता mask.

  1. पूर्ण tree, folders ना x.
setfacl -R -m g:audit:rX /srv/reports

Output:

(no output)

याचा अर्थ: Files r, folders r-x.

  1. nginx ला home folder मधून जाऊ द्या.
setfacl -m u:nginx:x /home/ravi

Output:

(no output)

याचा अर्थ: फक्त x: public_html पर्यंत, home list नाही.

5. Default ACLs: नव्या files साठी rules

हे का लागतं?

Defaults शिवाय shared folder मधल्या नव्या files ना ACL नाही आणि extra team चा access जातो.

हे काय आहे?

Folder वरची default ACL (setfacl -d -m किंवा -m d:...) आत बनणाऱ्या नव्या files आणि sub-folders ना copy होते. जुन्या files बदलत नाही, म्हणून त्यांच्यासाठी -R -m सोबत. Defaults फक्त folders ना.

कसं करायचं (step by step)

  1. Audit साठी default.
setfacl -d -m g:audit:rX /srv/reports && getfacl -c /srv/reports | grep default

Output:

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

याचा अर्थ: पुढच्या files ना audit access.

  1. नवी file तपासा.
touch /srv/reports/q4.csv && getfacl -c /srv/reports/q4.csv | grep audit

Output:

group:audit:r-x		#effective:r--

याचा अर्थ: Inherited; files ना x नाही.

  1. जुनं आणि पुढचं, दोन steps.
setfacl -R -m g:audit:rX /srv/reports && setfacl -R -d -m g:audit:rX /srv/reports

Output:

(no output)

याचा अर्थ: Shared folders चा नेहमीचा pattern.

6. ACL mask

हे का लागतं?

लोक user ला rw देतात तरी fail. सहसा mask कमी, बहुतेक chmod नंतर.

हे काय आहे?

mask:: म्हणजे named users, named groups आणि owning group साठी जास्तीत जास्त right. File ला ACL असेल तर chmod g=... group नाही, mask बदलतो. setfacl -m m::rwx set करतो. setfacl -n आपोआप mask recalculation थांबवतो.

कसं करायचं (step by step)

  1. chmod mask कमी करतो.
chmod 640 q3.csv && getfacl -c q3.csv | grep -E 'audit|mask'

Output:

group:audit:rw-		#effective:r--
mask::r--

याचा अर्थ: audit चा write गेला.

  1. Mask परत.
setfacl -m m::rw q3.csv && getfacl -c q3.csv | grep mask

Output:

mask::rw-

याचा अर्थ: audit परत लिहू शकतो.

7. setfacl -x आणि -b: entries काढा

हे का लागतं?

Contractor गेला किंवा test संपली की extra access स्वच्छ काढा.

हे काय आहे?

setfacl -x u:NAME FILE एक user entry काढतो, -x g:NAME group entry. -k सगळ्या default entries काढतो. -b पूर्ण ACL काढतो, फक्त साधे bits ठेवतो. Trees साठी -R.

कसं करायचं (step by step)

  1. priya काढा.
setfacl -x u:priya q3.csv && getfacl -c q3.csv | grep -c priya

Output:

0

याचा अर्थ: तिचा extra access गेला.

  1. फक्त defaults काढा.
setfacl -k /srv/reports

Output:

(no output)

याचा अर्थ: जुन्या entries राहतात.

  1. Tree मधून सगळे ACLs.
setfacl -R -b /srv/old && ls -ld /srv/old

Output:

drwxrwx--- 2 ravi finance 4096 /srv/old

याचा अर्थ: + गेला.

8. ACLs copy, backup, restore

हे का लागतं?

साधा cp किंवा tar ACLs गुपचूप सोडू शकतो, आणि restore नंतर लोकांचा access जातो.

हे काय आहे?

cp -a (किंवा --preserve=all) ACLs ठेवतो. rsync -aAX ACLs आणि xattrs ठेवतो. tar --acls --xattrs create आणि extract दोन्हीला. getfacl -R > file save; setfacl --restore=file परत. एका file ची ACL दुसरीला: getfacl a | setfacl --set-file=- b.

कसं करायचं (step by step)

  1. Tree चे ACLs save.
getfacl -R /srv/reports > /root/reports.acl && wc -l /root/reports.acl

Output:

58 /root/reports.acl

याचा अर्थ: Rights चा text backup.

  1. परत लावा.
cd / && setfacl --restore=/root/reports.acl

Output:

(no output)

याचा अर्थ: Paths / पासून relative.

  1. ACLs सह rsync.
rsync -aAX /srv/reports/ backup:/srv/reports/

Output:

(no output)

याचा अर्थ: A = ACLs, X = xattrs.

  1. ACLs सह tar.
tar --acls --xattrs -czf reports.tgz /srv/reports

Output:

(no output)

याचा अर्थ: Extract करताना पण --acls.

9. lsattr: file attributes list

हे का लागतं?

Root पण delete करू शकत नाही अशी file सहसा immutable. lsattr दाखवतो.

हे काय आहे?

lsattr FILE attribute letters: i immutable, a append-only, e extents (ext4 वर normal), A atime update नाही, d dump नाही. Folder साठी lsattr -d FOLDER, -R recursive. ext4 वर सर्वात चांगलं; XFS i आणि a.

कसं करायचं (step by step)

  1. साधी file.
lsattr notes.txt

Output:

--------------e------- notes.txt

याचा अर्थ: फक्त e: साधी ext4 file.

  1. Immutable file.
lsattr /etc/resolv.conf

Output:

----i---------e------- /etc/resolv.conf

याचा अर्थ: कोणीतरी lock केली.

  1. /etc मधल्या सगळ्या immutable files.
sudo lsattr -R /etc 2>/dev/null | grep -- '-i-'

Output:

----i---------e------- /etc/resolv.conf

याचा अर्थ: 'cannot modify' errors नंतर उपयोगी.

10. chattr +i: file immutable

हे का लागतं?

Critical file मधले अपघाती किंवा automatic बदल थांबवा (उदा. tool ने overwrite केलेली DNS config).

हे काय आहे?

sudo chattr +i FILE: chattr -i होईपर्यंत root सह कोणीही लिहू, delete, rename, link करू शकत नाही. फक्त root (CAP_LINUX_IMMUTABLE) set किंवा clear करू शकतो. Folder वर असेल तर आत files add किंवा remove नाहीत.

कसं करायचं (step by step)

  1. File lock.
sudo chattr +i /etc/resolv.conf && lsattr /etc/resolv.conf

Output:

----i---------e------- /etc/resolv.conf

याचा अर्थ: Lock.

  1. root पण नाकारला.
sudo rm /etc/resolv.conf

Output:

rm: cannot remove '/etc/resolv.conf': Operation not permitted

याचा अर्थ: Permissions ठीक; attribute थांबवतो.

  1. Edit साठी unlock.
sudo chattr -i /etc/resolv.conf && sudo vi /etc/resolv.conf

Output:

(editor opens)

याचा अर्थ: Edit नंतर परत lock.

11. chattr +a: append-only

हे का लागतं?

Logs वाढले पाहिजेत पण कधी edit किंवा truncate नाही, service account मिळवलेल्या attacker कडूनही.

हे काय आहे?

sudo chattr +a FILE: फक्त शेवटी data जोडता येतो (>>). Overwrite (>), truncate आणि delete fail. Log rotation ने आधी clear (chattr -a) करावं किंवा postrotate step.

कसं करायचं (step by step)

  1. Log append-only.
sudo chattr +a /var/log/audit-trail.log && lsattr /var/log/audit-trail.log

Output:

-----a--------e------- /var/log/audit-trail.log

याचा अर्थ: a set.

  1. Append चालतं.
echo 'login ravi' | sudo tee -a /var/log/audit-trail.log

Output:

login ravi

याचा अर्थ: नवी line.

  1. Overwrite fail.
echo x | sudo tee /var/log/audit-trail.log

Output:

tee: /var/log/audit-trail.log: Operation not permitted

याचा अर्थ: History safe.

12. अनेक industries मधली खरी उदाहरणं

हे का लागतं?

तेच Linux skill प्रत्येक प्रकारच्या company मध्ये लागतं. वेगवेगळ्या ठिकाणी पाहिलं की लक्षात राहतं.

हे काय आहे?

प्रत्येक row म्हणजे एक काल्पनिक team. कोण हे वापरतं आणि कसं ते दाखवते.

कसं करायचं (step by step)

Team आणि शहरते कसं वापरतातCommand
Pooja, CA firm, Puneएका auditor ला client folder readsetfacl -R -m u:auditor:rX /srv/clients/acme
Lars, media house, Stockholmनव्या videos ना editors चा accesssetfacl -d -m g:editors:rwX /srv/media
Fatima, hospital, DubaiAppend-only access logchattr +a /var/log/emr-access.log
Diego, ISP, Mexico Cityresolv.conf DHCP overwrite पासून lockchattr +i /etc/resolv.conf
Arjun, backup admin, ChennaiNightly rsync मधे ACLsrsync -aAX /srv/ nas:/backup/srv/
Mia, web host, Sydneynginx ला home list न करता entersetfacl -m u:nginx:x /home/mia

13. नेहमीच्या errors आणि त्यांचे fixes

हे का लागतं?

हे errors सगळ्यांना येतात. कारण माहीत असलं की तास वाचतात.

हे काय आहे?

आधी नेमका message वाचा. मग खालच्या row शी जुळवा.

कसं करायचं (step by step)

दिसणारा errorका होतंFix कसा करायचा
setfacl: command not foundacl package नाहीacl install.
sudo dnf install -y acl
setfacl: q3.csv: Operation not supportedACL support नसलेलं file systemSupported fs किंवा acl mount option.
findmnt -no FSTYPE,OPTIONS --target q3.csv
setfacl: Option -m: Invalid argument near character 3चुकीचा syntax, उदा. u-priya:ru:NAME:PERMS वापरा.
setfacl -m u:priya:r q3.csv
setfacl: Option -m: Invalid argument near character 3 (unknown user)User नाव अस्तित्वात नाहीid ने check.
id priya
User has ACL rw but still cannot write (#effective:r--)Mask कमी, बहुतेक chmod नेMask वाढवा.
setfacl -m m::rw q3.csv
New files in shared folder lack team accessDefault ACL नाहीDefault ACL जोडा.
setfacl -d -m g:audit:rX /srv/reports
ACLs lost after copy or restoreACL options शिवाय cp/tarcp -a, rsync -aAX, tar --acls.
rsync -aAX src/ dst/
rm: cannot remove 'x': Operation not permitted (as root)File immutableAttribute तपासा आणि clear.
lsattr x && sudo chattr -i x
logrotate: error renaming /var/log/app.log: Operation not permittedAppend-only किंवा immutable logRotation आधी +a काढा, नंतर परत.
sudo chattr -a /var/log/app.log
chattr: Operation not permitted while setting flagsroot नाही, किंवा capability नसलेला containerHost वर root म्हणून.
sudo chattr +i file

14. Troubleshooting step by step

हे का लागतं?

Access विचित्र असेल तर साधे bits, मग ACL आणि mask, मग attributes, मग SELinux.

हे काय आहे?

वरून खाली जा. ज्या step ला problem दिसतो तिथे थांबा.

कसं करायचं (step by step)

  1. Bits आणि +.
ls -l file
  1. पूर्ण ACL आणि effective rights.
getfacl file
  1. Parent folders पण.
namei -l /path/to/file
  1. i किंवा a attributes.
lsattr file
  1. File system ACLs support.
findmnt -T file
  1. शेवटी SELinux.
ls -Z file

15. Lab 1: दोन teams, एक folder

हे का लागतं?

/srv/reports finance चा; audit ला जुन्या आणि पुढच्या files वर read-only; एका contractor ला तात्पुरता read.

हे काय आहे?

पूर्ण hands-on lab. प्रत्येक step test Linux machine वर करा (EC2 instance, VM किंवा WSL).

कसं करायचं (step by step)

  1. Groups आणि folder.
sudo groupadd -f finance; sudo groupadd -f audit; sudo useradd -m -G audit aud1; sudo useradd -m contr1; sudo mkdir -p /srv/reports && sudo chgrp finance /srv/reports && sudo chmod 2770 /srv/reports

Output:

(no output)
  1. Audit ला आत्ता आणि पुढे read.
sudo setfacl -R -m g:audit:rX /srv/reports && sudo setfacl -d -m g:audit:rX /srv/reports

Output:

(no output)
  1. File बनवा आणि audit test.
echo total=100 | sudo tee /srv/reports/q4.txt >/dev/null && sudo -u aud1 cat /srv/reports/q4.txt && sudo -u aud1 sh -c 'echo x >> /srv/reports/q4.txt'

Output:

total=100
sh: /srv/reports/q4.txt: Permission denied
  1. Contractor ला read.
sudo setfacl -m u:contr1:rx /srv/reports && sudo setfacl -m u:contr1:r /srv/reports/q4.txt && sudo -u contr1 cat /srv/reports/q4.txt

Output:

total=100
  1. Contractor काढा.
sudo setfacl -x u:contr1 /srv/reports /srv/reports/q4.txt && sudo -u contr1 ls /srv/reports

Output:

ls: cannot open directory '/srv/reports': Permission denied

16. Lab 2: chattr ने files protect

हे का लागतं?

एक file immutable आणि एक log append-only, सिद्ध करा, मग undo.

हे काय आहे?

पूर्ण hands-on lab. प्रत्येक step test Linux machine वर करा (EC2 instance, VM किंवा WSL).

कसं करायचं (step by step)

  1. Test files.
sudo mkdir -p /srv/lab16 && echo v1 | sudo tee /srv/lab16/conf >/dev/null && echo start | sudo tee /srv/lab16/log >/dev/null

Output:

(no output)
  1. Attributes set.
sudo chattr +i /srv/lab16/conf && sudo chattr +a /srv/lab16/log && lsattr /srv/lab16

Output:

----i---------e------- /srv/lab16/conf
-----a--------e------- /srv/lab16/log
  1. conf बदलून बघा.
echo v2 | sudo tee /srv/lab16/conf

Output:

tee: /srv/lab16/conf: Operation not permitted
  1. log append आणि overwrite.
echo line2 | sudo tee -a /srv/lab16/log; echo wipe | sudo tee /srv/lab16/log

Output:

line2
tee: /srv/lab16/log: Operation not permitted
  1. Undo आणि साफ.
sudo chattr -i /srv/lab16/conf && sudo chattr -a /srv/lab16/log && sudo rm -r /srv/lab16

Output:

(no output)

Ravindra Bagale's Tip

When you add an ACL to a shared folder, always add the same rule as a default ACL too (-d), and check '#effective' in getfacl. Most 'ACL does not work' cases are a missing default or a low mask.

17. नेहमी विचारले जाणारे प्रश्न

प्र. ls -l मधे + म्हणजे?

File ला ACL आहे.

प्र. ACLs साध्या permissions बदलतात का?

नाही, त्यात भर घालतात. Owner आणि other bits लागू राहतात.

प्र. chmod ने ACL का तुटतो?

ACL असलेल्या file वर chmod चा group digit mask set करतो, जो named entries कापू शकतो.

प्र. root chattr +i bypass करू शकतो का?

आधी chattr -i ने attribute काढल्याशिवाय नाही.

प्र. NFS आणि containers मधे ACLs?

NFSv4 चे स्वतःचे ACLs (nfs4_setfacl); container bind mounts host fs चे ACLs ठेवतात.

प्र. Windows सारखा deny आहे का?

POSIX ACLs मधे नाही. कमी rights द्या, उदा. u:sam:---.

प्र. XFS वर काही letters ला chattr fail का?

XFS फक्त काही flags (i, a). बाकी ext4-only.

प्र. ACLs backup कसा?

getfacl -R > file, किंवा rsync -aAX, किंवा tar --acls.

18. मुलाखत प्रश्न आणि उत्तरं

Beginner level

प्र. ACL म्हणजे?

owner/group/other पलीकडे file वर user आणि group rights ची extra list.

प्र. ACL कसं वाचाल?

getfacl FILE.

प्र. priya ला file वर read.

setfacl -m u:priya:r FILE.

प्र. chattr +i काय करतो?

File immutable, root साठी पण.

Mid level level

प्र. Default ACL म्हणजे?

Folder वरची ACL जी आतल्या नव्या files आणि folders inherit करतात.

प्र. ACL mask म्हणजे?

Named users, named groups आणि owning group चे जास्तीत जास्त rights.

प्र. ACLs ठेवून copy कसं?

cp -a, rsync -aAX किंवा tar --acls --xattrs.

प्र. chattr +a vs +i?

+a फक्त append; +i काहीच बदल नाही.

Senior level

प्र. User ला rwx ACL entry आहे पण Permission denied. Debug.

#effective (mask), parent folder चा x, owner entry priority, lsattr flags, SELinux, आणि fs ACLs support करतं का.

प्र. Groups vs ACLs: कधी कोणतं?

स्थिर role-based access साठी groups; exceptions किंवा एकाच tree वर वेगळ्या rights असलेल्या teams साठी ACLs. खूप ACLs audit करायला कठीण.

प्र. root मिळालेला attacker chattr +a logs हरवू शकतो का?

हो, root flag काढू शकतो, म्हणून logs box बाहेरही पाठवा (remote syslog/SIEM).

प्र. सगळे rights ठेवून share migrate कसा?

rsync -aAXH --numeric-ids, दोन्हीकडे सारखे UIDs/GIDs, मग getfacl -R outputs compare.

घरी करून बघा

  1. Friend user ला कोणत्याही group मधे न घालता वाचता येईल पण लिहिता येणार नाही असा folder बनवा. getfacl आणि write test ने दाखवा.
  2. File immutable करा, root म्हणून delete करून बघा, मग unlock करून delete.

सराव Tasks

या scenario बद्दल

Amravati Agro Market हा अमरावती मधला शेती व्यवसाय आहे. Anjali Thakre त्यांचं IT व cloud काम पाहतात. त्यांचे पैसे INR मध्ये मोजले जातात आणि AWS resources ap-south-1 Region मध्ये चालतात. खालच्या tasks मध्ये तुम्ही या lesson मध्ये शिकलेलं वापरून त्यांची खरी कामं करता. सगळी नावं, account IDs, IP addresses व numbers सरावासाठी काल्पनिक आहेत.

0 / 17

सोपं ACL वाचा

का: ls मधे + दिसतो.

काय करायचं: /srv/ledger ची ACL.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

सोपं User ला read

का: BIZ मधे auditor.

काय करायचं: ACL ने kavya ला q4.csv वर read.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

सोपं Attributes बघा

का: root file delete करू शकत नाही.

काय करायचं: /etc/hostname चे attributes list.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम Header शिवाय ACL

का: दोन files compare सोपं.

काय करायचं: q4.csv ची ACL comment header शिवाय.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम Group ला write

का: Audit team file edit.

काय करायचं: ACL ने compliance group ला q4.csv वर read आणि write.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम पूर्ण tree, folders ना x

का: जुन्या files ना access.

काय करायचं: /srv/ledger वर compliance group ला recursively rX.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम नव्या files साठी default ACL

का: नव्या files ना access राहायला हवा.

काय करायचं: /srv/ledger वर compliance group ला rX देणारी default ACL.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम एक user काढा

का: Contractor ने BIZ सोडलं.

काय करायचं: q3.csv वरून contr1 user ची ACL entry काढा.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम सगळे ACLs काढा

का: Folder reset.

काय करायचं: old.txt वरून सगळ्या ACL entries काढा.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम ACLs सह copy

का: BIZ चा nightly backup.

काय करायचं: ACLs आणि xattrs ठेवून rsync ने /srv/data/ ते /backup/data/ (archive mode).

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम Immutable करा

का: Tools DNS config overwrite करू नयेत.

काय करायचं: /etc/hostname immutable करा.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम Immutable file unlock

का: आता edit करायची आहे.

काय करायचं: /etc/hostname वरचा immutable attribute काढा.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम Append-only log

का: Audit trail edit होऊ नये.

काय करायचं: /var/log/payments.log append-only करा.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

अवघड Mask वाढवा

का: chmod नंतर #effective r--.

काय करायचं: q4.csv चा ACL mask rw.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

अवघड फक्त default ACLs काढा

का: जुन्या entries राहाव्यात.

काय करायचं: /srv/ledger ची फक्त default ACL काढा.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

अवघड ACLs text मधे backup

का: Migration आधी.

काय करायचं: /srv/reports चे ACLs recursively reports.acl मधे save.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

अवघड caddy ला home मधून जाऊ द्या

का: home न उघडता ~/public_html.

काय करायचं: ACL ने caddy user ला /home/meera वर फक्त execute.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

थोडक्यात सांगायचं तर

  1. ls -l मधला + म्हणजे ACL.
  2. getfacl वाचतो, setfacl -m जोडतो, -x/-b काढतो.
  3. नव्या files साठी default ACLs (-d).
  4. Mask named entries ला मर्यादा; chmod बदलू शकतो.
  5. cp -a, rsync -aAX, tar --acls ने ACLs ठेवा.
  6. lsattr दाखवतो; chattr +i lock, +a append-only.

उजळणी, तुलना आणि मुलाखत cards

हा lesson काही मिनिटांत revise करा. Cards phone वर save करा किंवा PNG download करा. प्रत्येक card वरचा QR हा lesson उघडतो.

4 steps मधे ACLs. अजून एका user ला access. setfacl -m जोडतो, getfacl वाचतो. नव्या files साठी -d. एका user ला read.
उजळणी card: 4 steps मधे ACLs · PNG download करा · Card page उघडा
chattr locks. root सुद्धा बदलू शकत नाही. +i immutable, +a append only. lsattr flags दाखवतो. DNS config protect.
उजळणी card: chattr locks · PNG download करा · Card page उघडा
chmod vs setfacl. Owner, एक group, others. / कितीही users आणि groups.
तुलना: chmod vs setfacl · PNG download करा · Card page उघडा
chattr +i vs chattr +a. काहीच नाही: write, delete, rename नाही. / फक्त शेवटी जोडणं.
तुलना: chattr +i vs chattr +a · PNG download करा · Card page उघडा
ls -l मधला + काय?. File ला ACL आहे. chmod सगळा access दाखवत नाही. वाचा.
मुलाखत card: ls -l मधला + काय? · PNG download करा · Card page उघडा
ACL mask काय?. Named entries चे कमाल rights. Group वर chmod mask बदलतो. वाढवा.
मुलाखत card: ACL mask काय? · PNG download करा · Card page उघडा
नव्या files चा access जातो?. Normal ACLs जुन्या files ना. Default ACLs नव्या files ना. Default set.
मुलाखत card: नव्या files चा access जातो? · PNG download करा · Card page उघडा
root file delete करू शकत नाही?. ती immutable असेल. lsattr i दाखवतो. Flag काढा.
मुलाखत card: root file delete करू शकत नाही? · PNG download करा · Card page उघडा

अजून cards: Ravi Sir's Cards.