Linux Basics
Linux chown & chmod Explained With Real Examples
A simple beginner-friendly guide to understanding file ownership and permissions in Linux.
What is chown?
chown means change file or folder ownership.
Syntax:
chown user:group file
Examples:
chown mahesh file.txt
chown :developers file.txt
chown mahesh:developers file.txt
sudo chown -R www-data:www-data /var/www/html
What is chmod?
chmod changes permissions: read (r), write (w), execute (x).
Examples:
chmod 755 script.sh
chmod 644 index.html
chmod 600 mykey.pem
Symbolic:
chmod u+r file
chmod g-w file
Summary
chown= change owner & groupchmod= change permissions-Rapplies changes to all files inside folder
