chown & chgrp

The right to change ownership of a file is restricted to root. The owning group of a file can only be changed by users that are members of both groups: The one which owns it and the one that shall own it.

I think these rules make sense, since like it is, no-one can create a file 'myoppinionabouttheboss.txt' and secretly 'donate' it to somebody else, or a group that he has no access to.

stw@laptop:~> grep stw /etc/group
uucp:x:14:stw
dialout:x:16:stw
audio:x:17:stw
video:x:33:stw
stw@laptop:~> touch file
stw@laptop:~> ls -l file
-rw-r--r--  1 stw users 0 2004-05-17 11:53 file
stw@laptop:~> chgrp uucp file
stw@laptop:~> ls -l file
-rw-r--r--  1 stw uucp 0 2004-05-17 11:53 file
stw@laptop:~> chown :audio file
stw@laptop:~> ls -l file
-rw-r--r--  1 stw audio 0 2004-05-17 11:53 file
stw@laptop:~> chown :root file
chown: Ändern der Gruppe für „file“: Die Operation ist nicht erlaubt
stw@laptop:~> LANG=C chown :root file
chown: changing group of 'file': Operation not permitted
stw@laptop:~> rm file
/home/www/LinuxBasics.org/data/pages/tutorials/advanced/realworld/chown_and_chgrp.txt · Last modified: 2008/07/20 21:08 (external edit)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0