Linux is a multi-user operating system, so it has security to prevent people from accessing each other’s confidential files. When you execute an 'ls' command, you are not given any information about the details of the files. You can get more information by using an option with the 'ls' command.
The nine characters (3 sets of three characters) show the security or file permissions. Each of the three 'rwx' characters refers to a different operation you can perform on the file. If any of the characters is replaced by a hyphen (-), then that permission has been revoked.
- The ‘r’ means you can read the file contents.
- The ‘w’ means you can write, or modify, the file contents.
- The ‘x’ means you can execute the file. This permission is given only if the file is a program.
How to Change File Permissions
The command you use to change the security permissions on files is called chmod, which stands for change mode, because the nine security characters are collectively called the security mode of the file.
The first argument you give to the chmod command is u, g, o - u for user, g for group and o for others. This specifies which of the three groups you want to modify. After this, you use + for adding, - for removing and = for assigning a permission. Then, specify the permission r, w or x you want to change. Finally, enter the name of the file whose permission you are changing.
Equivalent Octal Notations
You can also use octal notations:
Each digit of octal notation can be used of either of the group u, g, o.
For example, 755 means 'rwxr-xr-x', which means the file's owner may read, write, and execute the file. All others may read and execute the file.
For example, 644 means 'rw-r--r--', which means the owner may read and write a file, while all others may only read the file.