Name

chmod [man page] - change file access permissions

Synopsis

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

Frequently used options

-R, --recursive
change files and directories recursively
-c, --changes
like verbose but report only when a change is made
-v, --verbose
output a diagnostic for every file processed

Basics

  • r : read (user can read the file, or list a given directory)
  • w : write (user can write to the file, or create file or directory in the directory)
  • x : execute (user can execute the file, or enter directory)
$ ls -ld dir/ 

show directory permitions
chmod octal and symbolic guide

Examples

Octal Mode

Let's see how we can change file.txt permissions to rwxr-xr-- with octal mode:

$ chmod 764 file.txt 

use octal chmod to change file permitions

Symbolic Specification

Symbolic specification is just another way to change file and directory permissions. In the next example we will change file.txt's permissions to rwxr-xr-- with a following symbolic specification:

$ chmod u=rwx,g=rx,o=r file.txt 

use symbolic chmod to change file permitions

ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME or create a JOB ALERT on LinuxCareers.com job portal.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in: