User Tools

Site Tools


permissions_for_directories

Permissions for Directories

2016



The same series of permissions may be used for directories but they have a slightly different behaviour.

      r - you have the ability to read the contents of the directory (ie do an ls)
      w - you have the ability to write into the directory (ie create files and directories)
      x - you have the ability to enter that directory (ie cd)


Example:

      ls testdir (list testdir contents)
      file1  file2  file3
      
      chmod 400 testdir (400 is 100000000) so r--- --- ---
      
      cd testdir (change directory to testdir)
      -bash: cd: testdir: Permission denied
      chmod 100 stops access to a directory



Example2:

      chmod 100 testdir - (100 = 001000000 or --x --- --- so execute rights only)
      
      ls testdir
      ls: cannot open directory testdir: Permission denied
      
      cd testdir - I can't list the director, but I can change to it
      cat file1 - and I can view a file I know exists!
      
      this is a test file
      you have opened it



I am sure I'll find a use for that? :)

permissions_for_directories.txt · Last modified: 2023/03/09 22:35 by 127.0.0.1