Every file and directory on a Linux filesystem has permissions attached to it. They can be referred two in two formats: by a six digit set of letters or by a set of three numbers. Here’s an example in letters:

rwxr-xr-x

The first three letters mean that the file can be read, written to and executed by the file’s owner; the middle three mean the file can be read and executed by the group of users the owner belongs to; and the final three letters means that everyone logged into the server can read and execute the file.

In a directory listing (using the command ls -l), you would see an extra character before the first ‘r’, normally either a dash (-) or the letter d. A dash means it’s an ordinary file and a d means it’s a directory.

Permissions can also be referred to, as I mentioned, by three numbers, as in: 755.

The 7 means that the file can be read by the owner (4), written by the owner (plus 2) and executed by the owner (plus 1) etc. The number-based approach is commonly used when changing a file’s permissions using the chmod command, e.g.

chmod 755 file.txt


No Responses Yet to “File and directory permissions”  

  1. No Comments Yet

Leave a Reply