How to use Sticky Bit to manage files on shared folders in Linux
Since its launch, Linux has been designed to support a multi-user environment. For many users and groups on a working system, it is common to encounter shared folders among users in the same group and problems also arise from file sharing in folders.
In this article, TipsMake.com discusses how you can use sticky bits to fine-tune file access on shared folders.
For illustrative purposes, the article has a system with 3 users - john1, john2 and john3 , all of which are members of a common group.
Suppose 'john1' creates a new directory named 'shared-dir' , which is shared among all johns users .
With the ls
command, we can view the permissions for 'shared-dir' , which is understood as follows: Only 'john1' can read the content as well as write to the directory. Because we are working with a shared folder, the goal is to make all users of the group write to 'shared-dir'.
To do so, we will modify the permissions using the chmod
command. We will add write permissions for all johns users, as shown below.

We can see updated permissions for 'shared-dir' as shown below. The yellow underlined section indicates that the johns group has been granted write permissions.
Add files to the shared folder
Now, john1 adds two files ( j1_file1.txt and j1_file2.txt ) to 'shared-dir'.
For ease of understanding, the first two characters of the file name are synonymous with the username.
Similarly, john2 can also be written to the 'shared-dir' directory.
There are currently 4 files in 'shared-dir'.

Is there a problem with the current settings?
File j1_file1.txt is created by john1 , the file owner. Now, john2 login and try to delete this file and he will be able to do so.
'john1' is the file owner, but 'john2' can delete it because the write permissions are granted to all members of the johns group .
This scenario is not ideal. We want all users to be able to write to the directory, but only the file owner can delete the file. How can this be achieved?
Introducing sticky bit
Sticky bits are a special permission, which is set on a write permissions folder for the whole group. This bit ensures that all members of the group can write to the directory, but only the file creator, or the file owner, can delete it.
The chmod
command with flag - t can be used to place sticky bits on a folder.
Updated rights can be seen below.

Now, if 'john2' tries to delete the file 'j1_file2.txt' created by 'john1', that operation will not be allowed.
If you remove the executable rights from others, then the existence of sticky bits in the folder is indicated by a capital letter in the 'others' section of the permission string. The behavior of sticky bits on the folder remains the same.

Variant of chmod command
The digital form of the chmod
command can also be used to place sticky bits on a folder.
chmod nxyz
Inside:
- n = 1 : Refers to sticky bits. Other values of n refer to other special rights.
- x : Rights to file owner.
- y : Permission granted to the group that has access to the file.
- z : Rights for others
To set sticky bit on 'shared-dir' , use the following command:
chmod 1755 shared-dir
The command produces the same result as using + t on existing default permissions.
The use of sticky bits is only suitable for folders and will not make sense when used for files.
You should read it
- Restore Sticky Note deleted on Windows
- Tips for using Sticky Notes in Windows
- How to Create a Sticky Note on a Mac's Dashboard
- How to use Windows 11 Sticky Notes on all devices
- How to cook sticky rice Gac, delicious blow away Gac
- Microsoft launched a new version for Sticky Notes on Windows 10 with a different experience
- Invite to download Vov Sticky Notes, the note creation app for $ 9.99, is free
- How to share Sticky Notes between computers
May be interested
- How to Sync Foldersthis article shows you how to share folders with other computers on your network. this allows any computer on the network to access and change files in the shared folder. you can share and access folders on windows and mac operating systems; however, the computer that contains the shared folder and the computer that has access to the folder must be on the same wireless (or wired) internet network. if you just want to synchronize a folder on your computer with a local folder or flash drive, you can use the freefilesync program.
- Instructions for creating ISO files on Linuxiso files are not only burned to cd/dvd or usb, but also used to back up and store files and folders. you can burn iso to disc or mount it as an external drive to access the contents inside.
- How to Access Shared Folders on a Networktoday's tipsmake will show you how to open a folder shared by another computer on the internet. you can do this on both windows and mac computers.
- Hide and protect folders on Windowsintroduce to free hide folder software, a free software to hide and set up passwords for private folders on your computer. if you regularly use a shared computer with others, then sometimes you also need to 'hide' something to avoid the general user's curiosity about some of your personal files or folders?
- How to manage photos on Linuximage management in linux is no longer as difficult as it used to be. however, with the explosion of smart phones today, the number of photos taken is more than ever. this means that a strategy is needed to manage images effectively.
- How to Share Files Between Linux Computers Using NFSnearly all linux distributions come with the ability to set up a network file system (nfs) that allows the different linux computers on the network to easily share files. nfs is only suitable for networks comprised entirely of linux...
- How to Use Windows Sticky Notes as the Ultimate Productivity Toolwith a few creative techniques, you can turn windows sticky notes into a complete productivity system, perfect for managing tasks, brainstorming ideas, and keeping everything in sight.
- How to Access Shared Folders on Androidthis wikihow teaches you how to access windows shared folders from android using es file explorer.
- How to copy (and paste) files and folders from the Linux command linecopying and pasting files is one of the most basic things you can do on your computer. on linux, you have several options to accomplish this.
- Manage files and folders in Pythonpython also provides a variety of methods to handle various directory-related operations. in this article, we will learn about managing files and directories in python, namely creating folders, renaming folders, listing folders and working with them.