Linux File Permissions and Ownership
Posted on June 1, 2024 (Last modified on June 8, 2024) • 1 min read • 196 wordsUnderstand file permissions and ownership in Linux, including how to view, change, and manage permissions and ownership using chmod, chown, and groups.
File permissions and ownership are fundamental concepts in Linux. This guide covers how to view, change, and manage file permissions and ownership using chmod, chown, and groups.
Use ls -l to view file permissions and ownership.
ls -l filenamePermissions are displayed as rwx (read, write, execute).
Use chmod to change file permissions.
chmod 755 filenamePermissions can be set using numeric or symbolic modes.
Change permissions using symbolic mode.
chmod u+x filename
chmod g-w filename
chmod o+r filenameUse chown to change file ownership.
chown user:group filenameUse chgrp to change the group ownership.
chgrp groupname filenameUse groupadd to create a new group.
sudo groupadd groupnameUse usermod to add a user to a group.
sudo usermod -aG groupname usernameUnderstanding and managing file permissions and ownership are crucial for system security and administration. Practice using chmod, chown, and managing groups to effectively control access to files and directories in Linux.