Puneet Varma (Editor)

Modes (Unix)

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

Modes are the file system permissions given to "user", "group" and "others" classes to access files. They are shown when listing files in long format, or, if Access Control Lists are in use, using getfacl. Modes can be changed with chmod (for traditional Unix permissions) or with setfacl (for Access Control Lists).

Contents

Format

For traditional Unix permissions, the symbolic mode is composed of three components, which are combined to form a single string of text:

$ chmod [references][operator][modes] file1 ...

The references (or classes) are used to distinguish the users to whom the permissions apply. If no references are specified it defaults to "all". They are represented by one or more of the following letters:

The chmod program uses an operator to specify how the modes of a file should be adjusted. The following operators are accepted:

The modes indicate which permissions are to be granted or taken away from the specified classes. There are three basic modes which correspond to the basic permissions:

The combination of these three components produces a string that is understood by the chmod command. Multiple changes can be specified by separating multiple symbolic modes with commas.

String mode examples

For example, the following command would be used to add the read and write permissions to the user and group classes of a file or directory named sample:

This command removes all permissions, allowing no one to read, write, or execute the file named sample.

The following command changes the permissions for the user and the group to read and execute only (no write permission) on sample.

References

Modes (Unix) Wikipedia