chmod - evanmoran/quick GitHub Wiki

Change access control of the file or directory.

Common

Readable by anyone. Writable only by user

chmod 644 <file>           # User:r/w, Group: r, Other: r

Readable and executable by anyone. Writable only by user.

chmod 755 <file>           # User: r/w/x, Group: r/x, Other: r/x

SSH File Permission: Only the user can read and write

chmod 600 <file>           # User: r/w

SSH Directory Permission. Only the user can read/write/execute

chmod 700 <directory>      # User: r/w/x

Add r/x to directories recursively. cd does not work on directories unless they have r/x, so this is used to quickly make a directory structure navigable.

chmod -R u+rX <directory>  # Recursively give: User: r/x

Key

Numbers

1                          # execute
2                          # write
3                          # execute + write 
4                          # read                       (common)
5                          # execute + read             (common)
6                          # write + read 
7                          # all                        (common)

Types

u                          # User
g                          # Group
o                          # Other

More Examples

chmod u+rw <file>          # User read and write (chmod 
chmod u=rw,go= <file>      # For a happy OpenSSH key! (chmod 600)
⚠️ **GitHub.com Fallback** ⚠️