Linux - Advanced File Permissions in Linux
Here we will discuss about the 3 special attributes other than the common read/write/execute. Example: drwxrwxrwt - Sticky Bits - chmod 1777 drwsrwxrwx - SUID set - chmod 4777 drwxrwsrwx - SGID set - chmod 2777 Sticky bit Sticky bits are mainly set on directories. If the sticky bit is set for a directory, only the owner of that directory or the owner of a file can delete or rename a file within that directory. Example: Consider you have a directory " test ". chmod it to " 777 ". This gives permissions for all the users to read, write and execute. chmod +t test Example: ls -al drwxrwxrwt 2 a1 a1 4096 Jun 13 2008 . -rw-rw-r-- 1 a1 a1 0 Jun 11 17:30 1.txt -rw-rw-r-- 1 b2 b2 0 Jun 11 22:52 2.txt From the above example a1 is the owner of the test directory. a1 can delete or rename the files 1.txt and 2.txt. b2 can delete or rename the file 2.txt only. SUID - [ Set User ID ] SUID bit is set for files ( mainly for scripts ). The SUID permission ma