There is an interesting file protection mode called the sticky bit, which has a useful effect when applied to directories. If the sticky bit is set on a directory, files inside the directory may be renamed or removed only by the owner of the file, the owner of the directory, or the superuser even if the modes of the directory would otherwise allow such an operation. This is effective for temporary directories such as /tmp and /var/tmp which must be accessible to many authorized users. The following two commands have the same effect:
# chmod a+rwxt /tmp
# chmod 1777 /tmp
allows anyone to create, read, and write files in /tmp, but only the file owner, the directory owner, or root can delete files
Monday, February 8, 2010
Subscribe to:
Post Comments (Atom)
By which command , how to check , whether sticky bit set on a directory or file or not ?
ReplyDeleteex: on /tmp how to check , whether sticky bit set or not, which command
ls -ld /tmp this command will give output like below
ReplyDeletedrwxrwxrwt 104 bin bin 14336 Aug 7 00:59 /tmp
the last 't' means its stickybit.