From 1a872b48a541087e286fa48af4fa3f726c9cfbed Mon Sep 17 00:00:00 2001 From: Jason Wilder Date: Sat, 5 Mar 2022 18:40:38 -0700 Subject: [PATCH] Fix extra driver permissions with jailer When using the jailer config with a different uid/gid and more than one attached volume, the additional volumes are still owned by root causing a permission error when the VM starts. This chowns the extra volume files to the jailer config uid/gid. --- jailer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jailer.go b/jailer.go index 910c7827..e318adc5 100644 --- a/jailer.go +++ b/jailer.go @@ -409,6 +409,10 @@ func LinkFilesHandler(kernelImageFileName string) Handler { return err } + if err := os.Chown(filepath.Join(rootfs, driveFileName), *m.Cfg.JailerCfg.UID, *m.Cfg.JailerCfg.GID); err != nil { + return err + } + m.Cfg.Drives[i].PathOnHost = String(driveFileName) }