summaryrefslogtreecommitdiff
path: root/test/root/restore.test
blob: 63a9d019a07d8766513a6edbcbc96f1ca562aa45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Ensure setuid bit is restored when the owner changes
 https://bugzilla.redhat.com/show_bug.cgi?id=467936#c7

Cry immediately if we are not running as root.

	$ require_root

	$ touch passwd
	$ chmod 755 passwd
	$ chmod u+s passwd
	$ getfacl passwd > passwd.acl
	$ cat passwd.acl
	> # file: passwd
	> # owner: root
	> # group: root
	> # flags: s--
	> user::rwx
	> group::r-x
	> other::r-x
	>
	$ chown bin passwd
	$ chmod u+s passwd
	$ setfacl --restore passwd.acl
	$ ls -dl passwd | awk '{print $1 " " $3 " " $4}'
	> -rwsr-xr-x root root

	$ rm passwd passwd.acl