only run test_unshare_userns() if not root user

This commit is contained in:
Johannes Schauer Marin Rodrigues 2021-08-18 22:06:16 +02:00
parent dfbf9cdcef
commit ea82b267c9
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -4239,7 +4239,7 @@ sub main() {
# lxc-usernsexec -- lxc-unshare -s 'MOUNT|PID|UTSNAME|IPC' ... # lxc-usernsexec -- lxc-unshare -s 'MOUNT|PID|UTSNAME|IPC' ...
# but without needing lxc # but without needing lxc
if ($ARGV[0] eq "--unshare-helper") { if ($ARGV[0] eq "--unshare-helper") {
if (!test_unshare_userns(1)) { if ($EFFECTIVE_USER_ID != 0 && !test_unshare_userns(1)) {
exit 1; exit 1;
} }
my @idmap = read_subuid_subgid; my @idmap = read_subuid_subgid;