Within the file permissions are controls for the three main actions that can be performed on a file: reading, writing, and executing. These permissions differ by user as well as collections of users called groups.
In Unix operating systems, the permissions for a file are represented using a line of 10 characters. The first character can either be
- for a file or
d for a directory. The other 9 characters are separated into three equal parts called triads.
The first triad containing the first three characters contains the permissions for the owner, the second triad contains the permissions for the group, and the third triad contains the permissions for any other user outside of this.
Each of these three characters within a triad are flags indicating a permission.
r means that the file is readable,
w means that the file is writable, and
x means that the file is executable.
To the right is a directory from a Linux operating system showing the permissions for a variety of files:
-rw-------means that the file is readable and writable for only the owner.
-rw-rw-rw-means that the file is readable and writable for all users on the system.
-rwxrwxrwxmeans that the file is readable, writable, and executable for all users on the system.
-rw-r--r--means that the file is readable and writable for the owners, but only readable for everybody else.
-r--r--r--means that the file is read only.