Linux Files and File Permissions

Overview#

Linux Files and File Permissions and Linux Directory Permissions are set or changed from the defaults using Chmod.

The default File System Permissions are set using umask.

All Files and directories have an owner which determines the File System's user class and to which distinct permissions may be applied.

You may also want to use the Linux setgid and setuid commands to set the "run as" values for certain files.

Linux files are setup so access to them is controlled. There are three types of access:

Each file belongs to a specific user and group. Access to the files is controlled by user, group, and what is called other. The term, other, is used to refer to someone who is not the user (owner) of the file, nor is the person a member of the group the file belongs to. When talking about setting permissions for "other" users to use, it is commonly referred to as setting the world execute, read, or write bit since anyone in the world will be able to perform the operation if the permission is set in the other category.

File names and permission characters#

File names can be up to 256 characters long with "-", "_", and "." characters along with letters and numbers.

When a long file listing is done, there are 10 characters that are shown on the left that indicate type and permissions of the file. File permissions are shown according to the following syntax example: drwerwerwe There are a total of 10 characters in this example, as in all Linux files. The first character indicates the type of file, and the next three indicate read, write, and execute permission for each of the three user types, user, group and other.

Since there are three types of permission for three users, there are a total of nine permission bits. The table below shows the syntax:

12345678910
FileUser Permissions<<Group Permissions<<Other Permissions<<
TypeReadWriteExecuteReadWriteExecuteReadWriteExecute
drwerwerwe

Numbers or Symbols

There are 5 possible characters in the permission fields. They are:

Examples#

Type "ls -l" and a listing like the following is displayed:
total 10						
drwxrwxrwx	4	george	team1	122	Dec 12 18:02	Projects
-rw-rw-rw-	1	george 	team1	1873	Aug 23 08:34	test
-rw-rw-rw-	1	george	team1	1234	Sep 12 11:13 	datafile

Which means the following:

The fields are as follows:#

Examples Using chmod#

We have some Examples Using chmod.

More Information#

There might be more information for this subject on one of the following: