Chmod


From Linuxconfig.org

Jump to: navigation, search

Name

chmod - change file access permissions

Synopsis - man page

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/
Image:chmod01.gif
Image:chmod.png

Examples

Octal Mode

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

$ chmod 764 file.txt
Image:chmod02.gif

Symbolic Specification

Lets see how we can change file.txt permissions to rwxr-xr-- with symbolic specification:

$ chmod u=rwx,g=rx,o=r file.txt
Image:chmod03.gif

Other Links

Linux Commands

Personal tools
Linux Commands