File permissions are displayed as a string of characters in Linux. Each character stands for specific permission, based on the position:
You can change file permissions with the chmod command. It supports two different methods, the text and numeric method. Text method is more intuitive and can set the permissions for one type of user. The numeric method is more complex but can set permissions for all types of users in one simple command.
The Syntax of this command is: chmod who=permissions, chmod who+permissions or chmod who-permissions as described below:
Numeric permissions are set by a 3-digit number. Every digit stands for the permissions for a specific user type. Starting with the first digit as the file owner, second as the group owner and third as other users permissions.
chmod 761 will set the file permissions to: rwxrw—x which can be calculated:
To change the ownership of a file execute chmod fileowner:groupowner, a -R parameter will do that recursively for all subdirectories and files located in a directory.
Files in modern Linux Filesystems can have different attributes that can change the behavior of them. You can use the lsattr command to look up all attributes and the chattr with a + or – to add or remove them.