file owner cannot chmod file, report operation not permitted
27,825
Check to see if the file is set as immutable.
root@hostname:/tmp# lsattr ./a.out
----i--------e-- a.out
That i means the file is immutable and cannot be changed. You have to use chattr -i ./a.out
to clear the flag, and then +i
to re-enable after making changes.
Related videos on Youtube
![Hao Liu](https://lh5.googleusercontent.com/-6NdSacPyYNE/AAAAAAAAAAI/AAAAAAAAABI/71mkbGUMkYY/photo.jpg?sz=256)
Author by
Hao Liu
Updated on September 18, 2022Comments
-
Hao Liu almost 2 years
- use root copy or create a file
a.out
chown user:user a.out
, changea.out
owner to user- now change to user,
su user
- use user to chmod a.out,
chmod 755 a.out
- Ok, problem is here. step 4 will output :
chmod: ./a.out: Operation not permitted
I run these step on SUSE, it's work. And chmod can use by file owner or root. So, i think this maybe a bug on Ubuntu. Anyone know this?
-
Rinzwind over 7 years"So, i think this maybe a bug on Ubuntu." doubt it. More likely the directory above where you did this? Or immutable flag? Or ACL.
-
muru over 7 yearsCould not reproduce
- use root copy or create a file
-
Hao Liu over 7 years. directory is user, but .. is root
-
marosg over 7 yearsCan you post output of the command ? And also output of "lsattr a.out"