Java J2ME JSP J2EE Servlet Android

UNIX Command: chmod

Changes the file or directory permission to a user, group or others

Synopsis
chmod [OPTION] .. MODE[,MODE] .. FILE ..
chmod [OPTION] .. OCTAL-MODE FILE ..
chmod [OPTION] .. --reference=RFILE FILE ..

Options
-c, --changes
like verbose but report only when a change is made
-f, --silent, --quiet
Suppress most error messages
-v, --verbose
Output a diagnostic for every file processed
--reference=RFILE
Use RFILE's mode instead of MODE values
-R, --recursive
Change files and directories recursively
--help
Display this help and exit
--version
Output version information and exit

Permissions
u - User who owns the file.
g - Group that owns the file.
o - Other.
a - All.
r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.

Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:

400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody


Example

chmod 644 file.txt
This gives the file file.txt read/write by the owner and only read by everyone else (-rw-r--r--).

chmod 755 file.txt
Gives all the rights but the capability for anyone to edit tile.txt (-rwxr-xr-x).

chmod 666 file.txt
Gives read and right permission to everyone.