What is Sticky Bit in Linux?
Sticky bit is a flag added to a directory/file to avoid removing/renaming it by any user other than the owner or root. Please check the below scenario:
Create a directory named “grepitout”
mkdir grepitout
Give all the users read-write-execute access to it
chmod 777 grepitout
Check the permission using the command below:
ls -ld grepitout
Output:
drwxrwxrwx 2 grepit grepit 4096 Feb 9 15:43 grepitout
Create different files in the directory as different users (get into the directory using “cd grepitout/”)
Please check the files and the ownership associated with them:
ls -la grepitout/ -rwxrwxrwx 1 grepit grepit 0 Feb 9 15:48 user1 -rwxrwxrwx 1 user1 user1 0 Feb 9 16:11 user1file -rwxrwxrwx 1 user2 user2 0 Feb 9 16:15 user2file
This means that the user2 can delete/rename files created by user1 and vice versa. Here we can set “Sticky Bit” to the directory using the command below:
chmod +t grepitout
You can check if the sticky bit is successfully added to the directory using the below command:
ls -ld grepitout drwxrwxrwt 2 grepit grepit 3096 Feb 9 16:19 grepitout
Please notice that “t” added at the end of the permission bit series “drwxrwxrwt”. You can remove the sticky bit using the command below:
chmod -t grepitout
That means +t to add sticky bit and -t to remove. Once the sticky bit is set the owner of the file can only be able to delete/rename the file/directory.
Read More:
- Understanding FTP ( File Transfer Protocol )
- How to restore and backup MBR in Linux
- Useful GIT Commands
- Configure NIC bonding in CentOS 7 / RHEL 7
- Difference between Hardlink and Softlink
- Understanding VI editor
- Understanding top Command
- How to add additional drive to CentOS server
- Linux File System Hierarchy
- How to avoid accidental deletion of files in Linux
- Useful Qmail Commands
- Useful Exim Commands
- Useful Postfix commands Linux
If you like the post Understanding top Command and wish to receive more articles from us, please like our FB page: GrepItOut
Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments. For more details on our services, please drop us an E-mail at [email protected]






























1xbet spor bahislerinin adresi 1xbet spor bahislerinin adresi .
1xbet resmi https://1xbet-13.com/ .
1xbet giri? yapam?yorum https://1xbet-12.com .
промокоды на сегодня
where was friends filmed nyc – where is central perk in new york
магнитогорск купить диплом магнитогорск купить диплом .
купить диплом вуз спб купить диплом вуз спб .
диплом дизайнера интерьера купить диплом дизайнера интерьера купить .
купить диплом свидетельство купить диплом свидетельство .
кто уже купил диплом на форуме кто уже купил диплом на форуме .
купить диплом вуза иркутск купить диплом вуза иркутск .
купить диплом герцена купить диплом герцена .
купить диплом о высшем образовании сургут купить диплом о высшем образовании сургут .
красный аттестат обложка купить красный аттестат обложка купить .
купить диплом колледжа в омске купить диплом колледжа в омске .
купить аттестат за 10 11 класс в москве купить аттестат за 10 11 класс в москве .