mirror of
https://github.com/containers/podman.git
synced 2025-12-01 10:38:05 +08:00
Merge pull request #23977 from giuseppe/fix-permissions-copyup-volume-userns
libpod: convert owner IDs only with :idmap
This commit is contained in:
@@ -1372,18 +1372,23 @@ EOF
|
||||
run_podman run --security-opt label=disable --uidmap=0:1000:200 --rm --rootfs "$romount:idmap=uids=@2000-1-1;gids=@2000-1-1" stat -c %u:%g /testfile
|
||||
is "$output" "1:1"
|
||||
|
||||
# verify that copyup with an empty idmap volume maintains the original ownership with different mappings and --rootfs
|
||||
myvolume=my-volume-$(safename)
|
||||
run_podman volume create $myvolume
|
||||
mkdir $romount/volume
|
||||
chown 1000:1000 $romount/volume
|
||||
run_podman run --security-opt label=disable --rm --uidmap=0:1000:10000 -v $myvolume:/volume:idmap --rootfs $romount stat -c %u:%g /volume
|
||||
is "$output" "0:0"
|
||||
for FROM in 1000 2000; do
|
||||
run_podman run --security-opt label=disable --rm --uidmap=0:$FROM:10000 -v $myvolume:/volume:idmap --rootfs $romount stat -c %u:%g /volume
|
||||
is "$output" "0:0"
|
||||
done
|
||||
run_podman volume rm $myvolume
|
||||
|
||||
# verify that copyup with an idmap volume maintains the original ownership
|
||||
# verify that copyup with an empty idmap volume maintains the original ownership with different mappings
|
||||
myvolume=my-volume-$(safename)
|
||||
run_podman run --rm --uidmap=0:1000:10000 -v $myvolume:/etc:idmap $IMAGE stat -c %u:%g /etc/passwd
|
||||
is "$output" "0:0"
|
||||
for FROM in 1000 2000; do
|
||||
run_podman run --rm --uidmap=0:$FROM:10000 -v $myvolume:/etc:idmap $IMAGE stat -c %u:%g /etc/passwd
|
||||
is "$output" "0:0"
|
||||
done
|
||||
run_podman volume rm $myvolume
|
||||
|
||||
rm -rf $romount
|
||||
|
||||
Reference in New Issue
Block a user