Advertisement

Change Permissions - chmod

Modify file permissions using numeric mode.

chmod 755 file.txt

Common permission numbers:

777 - rwxrwxrwx (read, write, execute for all)
755 - rwxr-xr-x (owner full, others read+execute)
644 - rw-r--r-- (owner read+write, others read)
600 - rw------- (owner read+write only)

Symbolic notation add permissions:

chmod u+x file.txt       # Add execute for owner
chmod g+w file.txt       # Add write for group
chmod o+r file.txt       # Add read for others
chmod a+x file.txt       # Add execute for all

Remove permissions:

chmod u-w file.txt
chmod go-rwx file.txt

Recursive chmod:

chmod -R 755 directory/

Change Owner - chown

Change file owner and group.

chown user file.txt

Change owner and group:

chown user:group file.txt

Change group only:

chown :group file.txt

Recursive:

chown -R user:group directory/
Advertisement

View Permissions

Display file permissions and ownership.

ls -l file.txt

Output format: -rwxr-xr-x owner group

Permission Symbols

Understanding permission notation:

r = read (4)
w = write (2)
x = execute (1)

First character: file type (- = file, d = directory, l = link)
Next 3: owner permissions (rwx)
Next 3: group permissions (r-x)
Last 3: others permissions (r-x)

Umask

Set default permissions for new files.

umask

Set umask value:

umask 022

Common umask values:

022 - New files: 644, directories: 755
027 - New files: 640, directories: 750
077 - New files: 600, directories: 700

Special Permissions

Setuid bit (run as owner):

chmod u+s file
chmod 4755 file

Setgid bit (inherit group):

chmod g+s directory
chmod 2755 directory

Sticky bit (only owner can delete):

chmod +t directory
chmod 1777 directory

Access Control Lists

View ACL permissions.

getfacl file.txt

Set ACL permissions:

setfacl -m u:username:rwx file.txt
Last updated: January 2026
Advertisement