From: George on 28 Apr 2010 10:23 Dear All, I am trying to change the owner of a file on my Linux system and it is giving me an error message saying that I am not the owner. However, >whoami city > ls -l test.sh -rwxr-xr-- 1 city web 182 Apr 28 12:50 test.sh >chown web test.sh chown: test.sh: Not owner What could be wrong? I am running these commands not as a super-user, but as the owner of the file I should be able to change ownership - unless there is something that I am completely overlooking. Regards, George
From: pk on 28 Apr 2010 10:36 George wrote: > Dear All, > > I am trying to change the owner of a file on my Linux system and it is > giving me an error message saying that I am not the owner. However, > > >whoami > city > > ls -l test.sh > -rwxr-xr-- 1 city web 182 Apr 28 12:50 test.sh > >chown web test.sh > chown: test.sh: Not owner > > What could be wrong? I am running these commands not as a super-user, > but as the owner of the file I should be able to change ownership - > unless there is something that I am completely overlooking. I think this is an historical matter; changing ownership of files to some other user could be used maliciously to escape quotas and other tricks, so I think you need to be either root or have a special Linux capability to do what you're trying to do. However, the error message I get on my Linux system is different from the one you're getting: chown: changing ownership of `counters.h': Operation not permitted
From: Ben Bacarisse on 28 Apr 2010 10:43 George <me(a)me.com> writes: > I am trying to change the owner of a file on my Linux system and it is > giving me an error message saying that I am not the owner. However, > >>whoami > city >> ls -l test.sh > -rwxr-xr-- 1 city web 182 Apr 28 12:50 test.sh >>chown web test.sh > chown: test.sh: Not owner > > What could be wrong? I am running these commands not as a super-user, > but as the owner of the file I should be able to change ownership - > unless there is something that I am completely overlooking. The owner of a file can't change it's ownership, at least not in an unrestricted way. You can change the group ownership to another group to which you belong, but that's about it. -- Ben.
From: Stachu 'Dozzie' K. on 28 Apr 2010 10:46 On 2010-04-28, pk <pk(a)pk.invalid> wrote: > George wrote: > >> Dear All, >> >> I am trying to change the owner of a file on my Linux system and it is >> giving me an error message saying that I am not the owner. However, >> >> >whoami >> city >> > ls -l test.sh >> -rwxr-xr-- 1 city web 182 Apr 28 12:50 test.sh >> >chown web test.sh >> chown: test.sh: Not owner >> >> What could be wrong? I am running these commands not as a super-user, >> but as the owner of the file I should be able to change ownership - >> unless there is something that I am completely overlooking. > > I think this is an historical matter; changing ownership of files to some > other user could be used maliciously to escape quotas and other tricks, so I > think you need to be either root or have a special Linux capability to do > what you're trying to do. Right. And add the following scenario that would be possible if you could change ownership without root privs: #v+ mkdir blah chmod a+w blah cat /bin/sh > blah/rootshell chown root blah/rootshell chmod 4755 blah/rootshell blah/rootshell #v- -- Secunia non olet. Stanislaw Klekot
From: George on 28 Apr 2010 11:21 Ben Bacarisse wrote: > George <me(a)me.com> writes: > >> I am trying to change the owner of a file on my Linux system and it is >> giving me an error message saying that I am not the owner. However, >> >>> whoami >> city >>> ls -l test.sh >> -rwxr-xr-- 1 city web 182 Apr 28 12:50 test.sh >>> chown web test.sh >> chown: test.sh: Not owner >> >> What could be wrong? I am running these commands not as a super-user, >> but as the owner of the file I should be able to change ownership - >> unless there is something that I am completely overlooking. > > The owner of a file can't change it's ownership, at least not in an > unrestricted way. You can change the group ownership to another group > to which you belong, but that's about it. > Is that not contradicted by the following excerpt from the man page of chown? The chown utility will set the user ID of the file named by each file to the user ID specified by owner, and, option- ally, will set the group ID to that specified by group. If chown is invoked by other than the super-user, the set- user-ID bit is cleared. Only the owner of a file (or the super-user) may change the owner of that file.
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Dealing with different number of fields in a file Next: Linuxrc and nash |