There are three types of special permission available for executable files and public directories . When we set these permission on any files or directories , it assumes that it is executed by owner or group of executable files rather than the user who execute it. Because this it is very clear that when you use these type of permission , it is security risk. In this short article i will explain you how to use special file permission in linux.

How to use special file permission in linux

There are three special permission that are available for executable files and directories . These are –

  1. Setuid permission
  2. Setgid permission
  3. Sticky bit

Setuid – 

In setuid files is executed with the file owner permission rather than with the permission of user who execute it . This special permission allows a user to access files or directories that are normally only available to the owner of that files or directories. Example – In the example given below , set a setuid at a file output.txt .

Setgid – 

If setgid is set on any directory , all sub directory and files created inside that directory will get same group ownership as main directory , it does not matted who is created .

setgid

Sticky bit – 

If sticky bit set on any directory , a file can be deleted only by the owner of the file , directory or root . This special permission restrict a user to delete files of other user from public directory .

sticky bit

You may also like to read following article :

In this short article , we discuss about how to use special file permission in linux .