Issue
I am attempting to make a file my_script.sh
executable by using the sudo chmod +x my_script.sh
command. I created the file my_script.sh with sudo gedit my_script.sh
I did my writing in the file, then I used chattr +i /etc/resolv.conf
to save the change.
I then attempted the sudo chmod +x my_script.sh
command, but received the output chmod: changing permissions of '/rw/config/vpn/qubes-vpn-handler.sh': Operation not permitted
. I've looked all over the web and on these forums and have found a number of posts offering solutions about changing ownership, etc. However, these all meet with the same result. I'm including some examples below, in case they're helpful:
[user@---]$ sudo chmod +x my_script.sh
chmod: changing permissions of 'my_script.sh': Operation not permitted
[user@---]$ sudo chmod +x my_script.sh
chmod: changing permissions of 'my_script.sh': Operation not permitted
[user@---]$ sudo rm my_script.sh
rm: cannot remove 'my_script.sh': Operation not permitted
[user@---]$ sudo chmod 0754 my_script.sh
chmod: changing permissions of 'my_script.sh': Operation not permitted
[user@---]$ sudo chown user my_script.sh
chown: changing ownership of 'my_script.sh': Operation not permitted
[user@---]$ sudo chmod u+x my_script.sh
chmod: changing permissions of 'my_script.sh': Operation not permitted
[user@---]$ sudo rm my_script.sh
rm: cannot remove 'my_script.sh': Operation not permitted
[user@---]$ sudo chmod -R a+x /[directory containing my_script.sh]
chmod: changing permissions of 'my_script.sh': Operation not permitted
If anyone can render assistance I would be most grateful.
Solution
It is because of the chattr +i
have a look at the man page : https://linux.die.net/man/1/chattr.
It prevents any user including the root from modifying or deleting a file. You can do chattr -i
to change that.
Answered By - Omar Aldakar Answer Checked By - Mary Flores (WPSolving Volunteer)