Files
mind-palace/cli/permissions.md
T

1.3 KiB

Setting Folder Permissions

Symbolic Notation

'''bash chmod u+rwx foldername # Give owner read, write, execute chmod g+rx foldername # Give group read and execute chmod o-rwx foldername # Remove all permissions for others chmod -R u+rw foldername # Recursively give read/write to owner '''

Numeric Notation

'''bash chmod 755 foldername # rwxr-xr-x (owner: all, group: read+execute, others: read+execute) chmod 700 foldername # rwx------ (owner: all, no permissions for group or others) chmod 777 foldername # rwxrwxrwx (all permissions for everyone - use cautiously) '''

The -R flag makes it recursive within every subfolder beneath the folder referenced.

Common permission numbers:

755: Owner can do anything, others can read and execute 644: Owner can read/write, others can read 700: Only owner has access 777: Everyone has full access (generally avoid this)

Setting Permissions to a Specific User

Use chown to set permissions to a specific user. (You'll almost always need to run with sudo)

'''bash

Change owner of a file/folder

chown username foldername

Change both owner and group

chown username:groupname foldername

Recursively change ownership (include all files and subfolders)

chown -R username foldername

Change owner and group recursively

chown -R username:groupname foldername '''