File Permissions Overview
Changing File Permissions Applications of File Permissions
  • In Linux, permissions are kept for every file and folder on your hard drive.
  • There are three different types of permissions: read (r), write (w), and execute (x).
  • You can check the file permissions for all the files in your current working directory by typing: # ls -la into a terminal window. Here is a sample output for the "/" directory (Please note that the ls command will only display the file permissions when the -l option is typed): -rw-r--r-- 1 root daemon 1852 Sep 17 16:25 .login_global -rw-r--r-- 1 root daemon 408 Jul 29 08:30 .logout_global drwxrwxrwx 2 root wheel 2048 Apr 2 2003 afs/ lrwxrwxrwx 1 root wheel 9 Sep 15 11:17 bin -> ./usr/bin/
  • The final column on this printout is the name of the actual file or directory. The first column of this printout contains the file permissions for each object in a column of 10 characters. Each of these characters has a specified meaning:
    • The first character specifies whether the object is a file (-), a directory (d), or a link to another file or directory (l).
    • The next group of three characters defines the read, write, and execute permissions (in that order) for the owner of the object.
    • The next group of three characters describes the permissions for the group that controls the object.
    • The final group describes the permissions for everyone else, usually called the global permissions.
  • The owner of the object is given in the third column, "root" in the example above.
  • The group the object belongs to is in the fourth column, "daemon" or "wheel" in the example above.
  • In this example, everyone can access, write to, and execute from the afs directory, but everyone except root can only read the .login_global file.
  • It is important to remember that the user root always has the ability to change the permissions on any file and directory regardless of the permissions set on them.