One Day One Command :-
====================
chmod -- CHange file access permission MODes
Summary :
chmod is used to change the permission of the file(s) or Dir(s).
Interpretation of one line of ls -l command output :-
-rwxr-xr-- 1 sbharathi dsg 10 Feb 14 15:00 myfile
^\ /\ /\ / \ / \ /
| V V V ---|--- -|-
| | | | | `-- group
| | | | `-- user/owner
| | | `-- others
| | `----- group
| `-------- user/owner
`---------- d=directory, -=file, l=link, b=blockdev, c=chardev, etc
There are three kinds of permissions that a user can have for a file:
r) Permission to read the file. For Dir, this means permission to
list the contents of the Dir.
w) Permission to write to (change) the file. For Dir, this means
permission to create and remove files in the Dir.
x) Permission to execute the file (run it as a program). For Dir, this
means permission to access files in the Dir.
There are three categories of users who may have different permissions
to perform any of the above operations on a file:
u) The file's owner;
g) Group users who are in the file owner's group;
o) Everyone else.
The permissions are stored internally as integers.
Value -- Notation -- Meaning
Basic:
1 x Execute
2 w Write
4 r Read
Ext:
3 (2+1) wx Write and Execute
5 (4+1) rx Read and Execute
6 (4+2) rw Read and Execute
7 (4+2+1) rwx Read, Write and Execute
Examples :
$ chmod 777 myfile -- All permission to all. Here permissions are
given in numerical format.
$ chmod 755 f1 f2 -- setting all permissions to owner and read &
Execute permissions to group and others.
$ chmod u=rwx,g=rx,o=rx myprg -- Same as above. But here permissions
are given in symbolic format.
$ chmod u+x,g+r,o-rwx myprg -- Add Exec permission to owner, Add Read
permission to group and Remove all
permission for others.
$ chmod u-x,go-rx myfile -- Remove Exec permission for owner and Remove
Read & Exec permissions for group & others.
$ chmod -R 755 mydir -- Set the permission for files & Dirs recursively.
$ chmod --reference=f1 f2 -- Set f1's mode to f2.
$ chmod -c 755 myfile -- Verbose but report only when a change is made.
$ chmod -v 754 myfile -- Verbose output for every file processed.
Note: `chmod' never changes the permissions of symbolic links.
Read : man chmod / info chmod
Bye :)
--
Bharathi S