sticky bit in Linux

In addition to read, write and executable (rwx), there are three special permissions for files and directories:

  • Sticky bit
  • SUID Permission
  • SGID Permission
The use of sticky bit is to have a folder shared between all the users.

For example, if you have a folder with 777 permissions, this means user for example user1 can delete the files can read, write and delete the files created by user2.


With sticky bit enabled on the directory, user1 can only read/write the file but cannot rename or delete the file.

/tmp is a folder in Linux with sticky bit enabled

How to set sticky bit?
chmod +t mydir

How to unset sticky bit?
chmod -t mydir


How to find out all directories with sticky bit enabled?


find / -perm +1000

chmod 1777 mydir will create the directory with sticky bit enabled

Comments

Post a Comment

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig