While working in a project, we all need to share various files and directories to our peers. It sometimes happens that a file gets deleted by mistake by the peers while working with it. In that case, if you do not have a backup of the file then a lot of hardwork gets wasted.
So, in Unix like system there are permission bits which let you chose what permission (read, or write, or execute, or all the three) do you want to give to a group, user, or others. But there is a fourth protection bit called the Sticky bit and it helps secure your files.
There are two major benefits of this Sticky Bit:
- When the sticky bit is on in a regular file it keeps the file loaded into the RAM so that you can access the files quickly.
- Helps you secure your file so that no one else can delete it.
Today memory has become cheap, so it is not so important to have sticky bit on for regular files. But when it comes to directories it is a really useful feature. The Sticky bit is by default set on in the /tmp directory. So, anyone can create any files or directory into the /tmp, but cannot delete other users files which are create there.
The sticky bit is useful for implementing group projects. Let us consider the situation, when a group of users work on a set of files without infringing on security...
1. Create a common group for the users in /etc/projects
2. Create seperate user accounts for each of them but specify the same home directory
3. Make sure the home directory and all subdirectories are not owned by any of the users.
4. Then, set the permission to group writeable abd set the sticky bit.
$ chmod 1775 [filename] or [directory], where chmod stands for 'change file mode bits'. For more information, type 'man chmod' on your terminal.
No comments:
Post a Comment