File: restore.test

package info (click to toggle)
acl 2.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,200 kB
  • sloc: ansic: 5,916; sh: 5,379; perl: 279; makefile: 49; sed: 16
file content (27 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (4)
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}' | sed 's/\\.//g'
	> -rwsr-xr-x root root

	$ rm passwd passwd.acl