CITS2002 Systems Programming  
prev
next CITS2002 CITS2002 schedule  

File and Directory Permissions

Recall that:

  • Like most modern systems, Linux arranges its file system in a hierarchical structure of files and directories. Directories may contain entries for files and other directories.
  • File entries contain the file's name, together with a pointer to a structure termed the inode (the information node?), which represents the details of the file.

These are the familiar items shown by the standard ls -l command:


 drwxr-xr-x   11 chris  staff   1024 Jul 29 20:29 WWW
 -rw-------    1 chris  chris  53436 Aug  1 16:28 autonomous.pdf 
 -rw-r--r--    1 chris  chris     88 Dec 20  2016 scrolldown.gif  

Multiple file entries, from possibly different directories, may point to the same inode. Thus, it is possible to have a single file with multiple names - we say that the names are links to the same file.

One unsigned 32-bit integer field in each inode contains the file's permission (or protection) mode bits - see /usr/include/bits/typesizes.h

From history, the permission mode bits appear in the same integer defining the file's type (regular, directory, block device, socket, ...) -
See man 2 stat for details.

 


CITS2002 Systems Programming, Lecture 16, p8, 19th September 2023.