Linuxexit code > 0
chmod: Operation not permitted
$chmod: changing permissions of '/etc/hosts': Operation not permitted
Analysis
You are trying to change permissions of a file you don't own, or a file on a filesystem that doesn't support permissions (like FAT32/NTFS mount).
Common Triggers
- ●Not the owner of the file.
- ●File is immutable (
chattr +i). - ●Mounted filesystem restriction.
Debug Checks
- $Check owner:
ls -l <file>. - $Check attributes:
lsattr <file>.
Resolution
1
Use
sudo.2
Remove immutable flag:
chattr -i <file>.Metadata
- Tool
- Linux
- Severity
- High
- Tags
- #linux#permissions#filesystem