Jan 24, 2024

Linux (Permission)

chmod WhoWhatWhich file | directory


  • Who - represents identities: u,g,o,a (user, group, other, all)
  • What - represents actions: +, -, = (add, remove, set exact)
  • Which - represents access levels: r, w, x (read, write, execute)

4 - read - r
2 - write - w
1 - execute -x

chmod | user | group | all | filename

chmod 777 mz.log

chmod 721 mz.log

chmod 217 mz.log

-------------------------

SPECIAL PERMISSION (SUID, SGID, and Sticky Bit)

SUID (Set User ID), SGID (Set Group ID), and Sticky Bit are critical attributes that extend beyond standard file permissions, providing powerful functionalities such as granting temporary privileges, controlling group access, and preserving data integrity. (Link)

chmod WhoWhatWhich file | directory

4 - SUID
2 - SGID
1 - Sticky Bit

chmod 4777 mz.log

chmod 2777 mz.log

chmod 1777 mz.log

u - user read


chmod u+s mz.log

chmod +x mz.log

chmod g+s mz.log

chmod a+t mz.log

chmod