Linux Permissions – The Symbolic Assignment of Permissions

L

Switching to another operating system or importing data may result in the failure of accessing your files or folders. This is because your user account lost the property of those files and folders or no longer has the permissions to access them. Also, accessing certain files or folders protected by the system sometimes involves changing their permissions. When you can not read or modify a file or folder on a disk, it means you have to take over its property or modify the permissions of your user account.

I was saying in a previous article that I will also present the symbolic way of assigning permissions to a file, in contrast to the octal mode of changing them.

The symbolic representation consists of:

• a code indicating the set of permissions that will be changed (owner, group, others);
• a symbol indicating how we want the change to be (adding, deleting, or setting identical to another value);
• a code that specifies which permission should be.

Assigning permissions in Linux

The following table shows the symbol allocation mode codes:

 

To use assignment of permissions in a symbolic mode, we will combine one or more codes in the first column of the table above with a symbol in the third column and one or more of the columns in the fifth column. You can combine multiple settings by separating them with commas.

Let’s suppose I have a file called ‘example’. It has, by default, permission 644 (-rw-r–r–). The chmod ug=rw example command assigns to the file the rw permissions for the owner and group – so the file will have the permissions -rw-rw-r–) after executing the command.

The chmod u-w, g-w, o+w example command will delete the user and group write permissions and assign the write permission to others – after the command is executed, the example file will have the -r–r–rw- permissions.

A general rule of permissions in Linux

As a general rule, symbolic permissions are more useful when we want to make a simple change (such as adding write or execution permissions for one or more classes of users) or when we want to make the same changes to multiple files without affecting other permissions (for example, adding write permission without compromising the permission).

The octal permissions are the most useful when we want to establish absolutely specific permissions, such as rw-r–r– (644).

In any case, a Linux user who wants to learn must be familiar with both modes of assignment.

The permissions of a file can only be changed by its owner or administrator (root). Even if other users have the right to write inside of a directory or files, they can not change the permissions.

About the author

Ilias spiros
By Ilias spiros

Recent Posts

Archives

Categories