bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: chown


From: Bob Proulx
Subject: Re: chown
Date: Fri, 28 May 2004 09:26:53 -0600
User-agent: Mutt/1.3.28i

Thanks for your report.  But what you are seeing is not a bug.  It is
normal behavior of the linux kernel.  On different kernels you will
see different behavior.

Wilco de Vries wrote:
> as a new user to linux, but well-know with UNIX-systems, I found it
> rather strange to see what happens whenever I use the chown command.

I am sure you have been using SysV derived systems and not BSD
systems.  If you had been a long time user of BSD instead of SysV then
you would fine the reverse situation just as strange.

> I (userone) create a file in /tmp and want to make usertwo owner of it:
> userone and usertwo both are normal users of the system.
> [...]
> chown: changing ownership of `aa': Operation not permitted

This is a restriction of the operating system and not of GNU chown.
The GNU chown program will change the ownership if the operating
system it is running upon allows it.  If you can't change file
ownership then it is the operating system which is restricting you and
not the chown program.

Here is one manifestation of the problem that the kernel is solving
with this behavior.  On a SysV-like system the following sets up the
problem.  This often happens when a user untars a file with restricted
permissions on the contents.  I will assume that $HOME is on the local
disk and is not NFS or otherwise network mounted.

  mkdir $HOME/trouble
  touch $HOME/trouble/foo
  chmod a-w $HOME/trouble/foo $HOME/trouble
  chown root:root $HOME/trouble/foo $HOME/trouble

Now try to clean up and remove those files.  You will find that you
cannot clean up after yourself.  You have created a situation that
only the superuser can fix.

The FAQ has a more lengthy explanation.  Look for the section,
"Why can only root chown files?" for more details.

  http://www.gnu.org/software/coreutils/faq/

Hope that helps,
Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]