Linux: Managing the permissions of directory


  • Read, write and execute permissions for files are simple but since directory is nothing but a file containing the names of the file, a read permission on a directory mean listing of the directory contents. But you cannot change over to that directory or remove or modify files.
  • If you have only write permission to a directory, it is as good as having no permissions at all. You cannot read its contents as no listing is allowed and you cannot enter it as no execute permission exist.
  • Similarly assigning an execute permission will make you to change over to that directory. But you can neither read nor modify or create files in the directory.
  • Owner can set the sticky bit for a directory. This sticky bit t will guard against an intruder trying to remove or modify them.
  • Sticky bit can be set to a directory as shown in the following command.

  • Example: chmod u+t artist (Name of the directory is artist)

  • ls –l artist (This command will generate say the following long listing for the directory artist, you can see 't' there.)
  • drwxrwxrwt 2 vp group 45 Feb 13 10:55 artist
  • Thus the files saved in a directory whose sticky bit is set cannot be removed but can it be modified? It depends on the file permissions given to that file.

  • Can a sticky bit assigned to a file?
    –Yes but this will make the file stay in the memory even after the execution of that file is over so that when next time it is needed to be executed it need not be read from the hard disk. Thus making the execution faster.

  • Only superuser can set the sticky bit for a file.
  • Files within the shared directory should also have their permissions set to allow access by other users in the group.
  • When a user places a file in a shared directory, permissions on that file need to be changed to allow other members of the group to access it.
  • A read permission will let others display it, write lets them change it, and execute lets then run it (used for scripts and programs).

Linux: Managing the permission of file << Previous
Next>>Linux: Displaying contents of files


Our aim is to provide information to the knowledge seekers. 


comments powered by Disqus








Footer1