chmod

Change file permissions

Usage

      chmod PERMISSIONS FILE
    

Applies PERMISSIONS to FILE

Common Flags

+PERMISSION Add PERMISSION (w=write, r=read, x=execute)-PERMISSION Remove PERMISSION (w=write, r=read, x=execute)TARGET+PERMISSION Add PERMISSION to TARGET (u=user/owner, g=group, o=others)TARGET-PERMISSION Remove PERMISSION from TARGET (u=user/owner, g=group, o=others)

Examples

Add permission

      chmod +w file.txt
    

Makes file.txt writable for everyone

Add permission for owner

      chmod u+x file.txt
    

Makes file.txt executable for the owner

Remove permission

      chmod -x file.txt
    

Removes execute permission for file.txt

Remove permission for other users

      chmod o-r file.txt
    

Removes read access for other users

Standard file permissions

      chmod 644 file.txt
    

Owner: read and write, others: read only

Make script executable

      chmod 755 program
    

Owner: read, write, and execute, others: read and execute

Private file

      chmod 600 secret.txt
    

Owner: read and write, others: no access