chmod command

06.06.2009

14>chmod command.

SUMMARY:

chmod is a Unix command that lets you tell the system how much (or little) access it should permit to a file.
This manual page documents the GNU version of chmod. chmod changes the permissions of each given file according to mode, which can be either a symbolic representation of changes to make, or an octal number representing the bit pattern for the new permissions.

SYNTAX:

-c, –changes     like verbose but report only when a change is made
–no-preserve-root     do not treat `/’ specially (the default)
–preserve-root     fail to operate recursively on `/’
-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.

EXAMPLES:

1. To view your files with what permission they are:

ls -alt

This command is used to view your files with what permission they are.
2. To make a file readable and writable by the group and others.

chmod 066 file1.txt

3. To allow everyone to read, write, and execute the file

chmod 777 file1.txt

Advertisements