[BACK]Return to chown.test CVS log [TXT][DIR] Up to [Development] / xfs-cmds / nfs4acl / test

File: [Development] / xfs-cmds / nfs4acl / test / chown.test (download)

Revision 1.2, Thu Jul 24 16:03:29 2008 UTC (9 years, 3 months ago) by tes.longdrop.melbourne.sgi.com
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines

Use ``id -Gn'' instead of ``groups'' to figure out which groups a user is in
 in test scripts.
Merge of master-melb:xfs-cmds:31754a by kenmcd.

$ mkdir d
$ cd d

$ whoami
> root

$ id -Gn daemon
> daemon bin

$ touch a

Chown and chgrp with no take ownership permission fails:
	$ su daemon
	$ chown daemon a
	> chown: changing ownership of `a': Operation not permitted
	$ chgrp daemon a
	> chgrp: changing group of `a': Operation not permitted
	$ nfs4acl --set 'daemon:rwo::allow' a
	> a: Operation not permitted

Add the take_ownership permission. This is reflected in the file masks; the
file mode cannot show this though:
	$ su
	$ nfs4acl --set 'daemon:rwo::allow' a

Chown and chgrp to an arbitrary other user or group fails:
	$ su daemon
	$ chown root a
	> chown: changing ownership of `a': Operation not permitted
	$ chgrp root a
	> chgrp: changing group of `a': Operation not permitted

Changing the mode makes that an upper bound of the permissions granted, even
when the file mode stays the same:
	$ su
	$ ls -l a | cut -d ' ' -f1
	> -rw-rw----
	$ chmod 660 a

Chown and chgrp to the same user or a group the process is in now fails
because the masks now do not grant change_ownership access:
	$ su daemon
	$ chown daemon a
	> chown: changing ownership of `a': Operation not permitted
	$ chgrp daemon a
	> chgrp: changing group of `a': Operation not permitted
	$ chgrp bin a
	> chgrp: changing group of `a': Operation not permitted

Add back change_ownership:
	$ su
	$ nfs4acl --set 'daemon:rwo::allow' a

Now, chgrp to one of the groups the process is in and chown to the same user
succeeds:
	$ su daemon
	$ chgrp daemon a
	$ chgrp bin a
	$ chown daemon a

$ su
$ cd ..
$ rm -rf d