chown: changing ownership of ` ': Operation not permitted

JohnMerlino

I know this is possible duplicate but I looked at other answers and wasn't satisfied with the responses. You should be able to use the chown command if you are the super user OR the owner of the file. Well, in my case I am the owner of the file, and I want to use chown. But I want to change ownership of file to super user, so I type following:

$ chown root testfile

But it gives me error:

 chown: changing ownership of `testfile': Operation not permitted

However, I am the owner of the file, and granted myself read, write, and execute permission on the file:

-rwx------  1 viggy viggy      10 Nov 14 13:01 testfile

So as the owner of the file, why can I not change ownership of the file?

Florian Diesch

You need to be root to change the ownership of a file. Ordinary users can't do that.

Otherwise it would be easy to get a root access by just using chmod to set the SETUID bit and then changing the ownership to root.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

chown: changing ownership of ` ': Operation not permitted

From Dev

chown: changing ownership of `...': Operation not permitted

From Dev

Changing ownership of ‘/usr/bin/’: Operation not permitted

From Dev

Changing Ownership: "Operation not permitted" - even as root!

From Dev

chown - Operation not permitted

From Dev

chown command returning Operation not permitted

From Dev

kubernetes mysql chown operation not permitted

From Dev

sudo chown fails with operation not permitted

From Dev

rsync chmod and chown operation not permitted

From Dev

chown failed: Operation not permitted (permission related)

From Dev

chmod: changing permissions of Operation not permitted

From Dev

Why does chown report "Operation not permitted" on OS X?

From Dev

"Operation not permitted" when I tried to change ownership and permissions

From Dev

chmod: changing permissions of directory Operation not permitted

From Dev

chmod: changing permissions of directory Operation not permitted

From Dev

Operation not permitted

From Java

chmod: changing permissions of 'myscript.sh' : Operation not permitted

From Dev

chmod: changing permissions of ‘my_script.sh’: Operation not permitted

From Dev

Docker & nginx operation not permitted

From Dev

npm "operation not permitted"

From Dev

React Native Operation Not Permitted

From Dev

Perl: Operation not permitted

From Dev

ls: Operation not Permitted

From Dev

zramswapon failed: Operation not permitted

From Dev

set times: Operation not permitted

From Dev

/sbin/ifconfig "Operation not permitted"

From Dev

swapon: Operation not permitted

From Dev

modprobe fails with "Operation not permitted"

From Dev

SIOCSIFFLAGS: Operation not permitted

Related Related

HotTag

Archive