In this example, we use the file_ownership directory under your personal home directory.
Check file/directory permission:
[yuni@lovely-linux yuni]$ cd file_ownership [yuni@lovely-linux file_ownership]$ ls -lR . -rw------- 1 yuni yuni 657 Jul 12 10:04 bashrc ./sub_dir_1: total 25 drwx------ 2 yuni yuni 512 Jul 12 10:04 ./ drwx--x--x 251 yuni yuni 24064 Jul 12 10:04 ../ -rw------- 1 yuni yuni 608 Jul 12 10:04 fstab
Both files bashrc and fstab are read-writable by the owner herself. The directory sub_dir_1 is read-writable and executable by the owner herself. The executable permission is needed for directory to be accessible.
To grant read access of fstab to every users in the system, you need to:
Check new file permission:
[yuni@lovely-linux file_ownership]$ ls -lR . -rw------- 1 yuni yuni 657 Jul 12 10:04 bashrc ./sub_dir_1: total 25 drwx--x--x 2 yuni yuni 512 Jul 12 10:04 ./ drwx--x--x 251 yuni yuni 24064 Jul 12 10:04 ../ -rw-r--r-- 1 yuni yuni 608 Jul 12 10:04 fstab
For detailed usage of chmod command, see manpage.
In the above example, "a+x" and "a+r" mean all (a), i.e. user, group, and other, add (+), executable (x) and readable (r). Effectively, they grant executable permission to all users and read permission to all users respectively.
The alternative as shown above use numbers instead of symbolic mode specification. The number 711 and 644 should be read as 3-digit numbers. The 3 digits refer to the desired permission for owner, group and others respectively represented in binary number form.