Learn all about chmod command
On Linux and other Unix-like operating systems, there is a set of rules for each file which defines who can access that file, and how they can access it. These rules are called file permissions or file modes. The command name chmod stands for "change mode", and it is used to define the way a file can be accessed.
In general, chmod commands take the form:
root:~# chmod options permissions FILENAMEpermissions defines the permissions for the owner of the file (the "user"), members of the group who owns the file (the "group"), and anyone else ("others"). There are two ways to represent these permissions: with symbols (alpha characters), or with octal numbers (the digits 0 through 7).
Numerical Method 2^0 = 1 -- execute 2^1 = 2 -- write 2^2 = 4 -- read
Alpha Method w -- write r -- read x -- execute u -- user g -- group o -- others a -- all + -- Add specified permissions to the mention user/group/others/all - -- Remove specified permissions to the mention user/group/others/all = -- Replicate the permissions to other class of the group/user/others
root:~# ls -l / drwxr-xr-x 2 root root 4096 Mar 21 08:51 bin drwxr-xr-x 4 root root 4096 Mar 21 08:53 boot drwxr-xr-x 14 root root 13880 Mar 21 08:55 dev drwxr-xr-x 109 root root 8192 May 29 05:14 etc -rwxr-xr-x 109 root root 8192 May 29 05:14 my_file d/- = First character represents Type of File. Here 'bin','boot','dev','etc' are directory and 'my_file' is file so it will be represented by -. rwx = Next three characters represent User's Read,Write and Execute. rwx = Next three characters represent Group's Read,Write and Execute. rwx = Next three characters represent Other's Read,Write and Execute.
root:~# chmod --h root:~# man chmod