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

Re: Unrestrict chown?



Christopher Zimmermann <madroach@zakweb.de> writes:

> Hi!
>
> On my debian box using linux kernel its not possible to give away files:
>
> madroach@machine:~% touch foo
> madroach@machine:~% chown otheruser foo
> chown: changing ownership of `foo': Operation not permitted
>
> only root can change file owners. Is it possible to configure this
> behaviour and allow all users to chown their own files? I read this was
> possible on solaris and several other unices and wonder if it is
> possible with linux.

As others have mentioned, normally this is a bad idea.  But if you
have a specialized need for it, you can write a small program to open
the file, check the owner with fstat, then change the owner with
fchown.  If you install this program setuid it will let you give this
capability to your users.

If you just need this for particular application, it could check if
the files match some other criteria, like being in the right
directory.

If you used this approach, you would need to take great care in
writing the program so it doesn't allow users to give away others'
files.

-----Scott.


Reply to: