-
-
Notifications
You must be signed in to change notification settings - Fork 3
Linux chmod chown Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to chmod and chown on Linux, covering Arch Linux, CachyOS, and other distributions including file permissions, ownership, and access control.
Three permission types:
- Read (r): View file contents
- Write (w): Modify file
- Execute (x): Run file as program
Three permission groups:
- Owner: File owner
- Group: File group
- Others: Everyone else
Numeric values:
- 4: Read
- 2: Write
- 1: Execute
- 7: Read + Write + Execute (4+2+1)
- 6: Read + Write (4+2)
- 5: Read + Execute (4+1)
Basic syntax:
# Change permissions
chmod permissions file
# Numeric mode
chmod 755 file.txt
# Symbolic mode
chmod u+x file.txtSet permissions:
# Owner: read+write+execute, Group: read+execute, Others: read+execute
chmod 755 file.txt
# Owner: read+write, Group: read, Others: read
chmod 644 file.txt
# Owner: read+write+execute, Group: none, Others: none
chmod 700 file.txtModify permissions:
# Add execute for owner
chmod u+x file.txt
# Remove write for group
chmod g-w file.txt
# Add read for others
chmod o+r file.txt
# Set all permissions
chmod a=rwx file.txtBasic syntax:
# Change owner
chown user file.txt
# Change owner and group
chown user:group file.txt
# Recursive
chown -R user:group directory/Common uses:
# Change owner
sudo chown username file.txt
# Change owner and group
sudo chown username:groupname file.txt
# Change recursively
sudo chown -R username:groupname directory/File permissions:
# Executable script
chmod 755 script.sh
# Configuration file
chmod 644 config.conf
# Private file
chmod 600 private.txt
# Directory
chmod 755 directory/Directory needs:
- Read: List directory contents
- Write: Create/delete files
- Execute: Enter directory
# Standard directory
chmod 755 directory/
# Private directory
chmod 700 directory/Fix permissions:
# Check current permissions
ls -l file.txt
# Add execute permission
chmod +x file.txt
# Or use sudo
sudo chmod 755 file.txtFix ownership:
# Check ownership
ls -l file.txt
# Change owner
sudo chown username file.txtThis guide covered chmod and chown usage, file permissions, and ownership for Arch Linux, CachyOS, and other distributions.
- User and Groups - User management
- System Configuration - System setup
-
chmod Documentation:
man chmod -
chown Documentation:
man chown
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.