Table of Contents
This tip is about the how to Use SUID, SGID, and Sticky Bits on Linux. So read this free guide, How to Use SUID, SGID, and Sticky Bits on Linux step by step. If you have query related to same article you may contact us.
How to Use SUID, SGID, and Sticky Bits on Linux – Guide
The sticky bit is used to indicate special permissions for files and directories. When a sticky bit enabled directory restricts the deletion of the file it contains. It can be removed by root, the file’s owner, or whoever needs write access to it. This is useful for public directories like /tmp. Like the SUID, the process has the same group rights as the file being executed. If the SGID bit is set to any directory, all subdirectories and files created within it will have the same group ownership as the root directory, no matter who creates them. Let’s start with Sticky Bit first. Because that’s the easiest to explain. Setting the sticky bit tells Unix that once the application in question has run, it must remain in memory.
Remember that Unix is a multi-user operating system and was primarily designed to allow multiple users to work at the same time. Thus, the logic used is that when a new user requests the same program, an existing program in memory takes less time to start. So if a user just used a program and a new user wants to use the same program, the second user doesn’t need to put up with a time delay for the program to start. It would be readily available to him. The sticky bit concept was very useful long before fast disk access and other storage access technologies existed.
Defined User ID (SUID)
How to set SUID in a file?
Set group identification (SGID)
SGID permission on executable file
How to set GUID in a file?
SGID in a directory
How to set SGID in a directory
sticky bit
Sticky bit example:
How to set sticky bit permission?
Final note
I hope you like the guide How to Use SUID, SGID, and Sticky Bits on Linux. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.