LinuxBasics.org

The community that helps people to run Linux

rss

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

Copyright (c) by the authors.
Prior to editing, authors agreed to license their contributions by the terms of the GPL.
See our licensing page for details.


Linux® is a registered trademark of Linus Torvalds.


 
  tutorials/advanced/realworld/chown_and_chgrp.txt · Last modified: 2008/07/20 19:08

LinuxBasics.org

Start Linux-Course Tutorials Linux Links Security Blog Forum E-mail List Search Online Chat

Site-Info

Help Get in Touch Making of LBo

Wiki-Control

Powered by

Linux Apache DokuWiki Mailman RUTE ht://Dig