Importants permisson linux commands
Importants permisson linux commands
ls -l filename
Output Example:
1: Number of links
user: Owner
group: Group
12345: File size
Syntax:
Symbolic Mode:
5. Changing Ownership
chown: Changes the owner and/or group of a file or directory.
Syntax:
chown [options] owner[:group] file
Examples:
Change Owner:
Syntax:
chgrp [options] group file
Examples:
Change Group:
Example:
Example:
chmod g+s /path/to/directory
Sticky Bit (t): When set on a directory, only the file’s owner can delete
or rename the files within that directory.
Example:
chmod +t /path/to/directory
8. Examples and Use Cases
Add execute permission to a script:
chmod +x script.sh
Remove write permission from a file for the group:
chmod +t /tmp
9. Checking Effective Permissions
To check effective permissions on a file or directory:
namei -l /home/user/file.txt