Linux Permissions and Links Cheat Sheet

Change permissions, ownership, umask, and symbolic or hard links on Linux.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

chmod Basics

Add execute permission for user

Grant user execute permission.

bashANYchmodpermissions
bash
chmod u+x script.sh

Set file to 644

Common mode for normal text or config files.

bashANYchmodoctal
bash
chmod 644 config.ini

Set file or directory to 755

Common executable/script or directory mode.

bashANYchmodoctal
bash
chmod 755 deploy.sh

Change permissions recursively

Apply mode changes to a directory tree.

bashANYchmodrecursivedirectories
bash
chmod -R u=rwX,go=rX project

Ownership and umask

Change owner and group

Set file owner and group together.

bashANYchownownership
bash
sudo chown alice:developers app.log

Recursively change ownership

Update owner and group across a tree.

bashANYchownrecursive
bash
sudo chown -R www-data:www-data /var/www/app

Change group

Set a file's group without changing owner.

bashANYchgrpgroup
bash
chgrp developers shared.txt

Show and set umask

Inspect and change default permission mask.

bashANYumaskpermissions
bash
umask && umask 027

Special Permission Bits

Set setuid bit

Set executable to run with owner's effective UID.

bashANYchmodsetuidsecurity
bash
chmod u+s binary

Set setgid on directory

New files inherit directory group.

bashANYchmodsetgiddirectories
bash
chmod g+s shared-dir

Set sticky bit on directory

Allow only owners/root to delete their own files.

bashANYchmodsticky-bitdirectories
bash
chmod +t /shared/tmp

More in Linux Permissions and Links

No other published sheets yet.

Recommended next

No recommendations yet.