mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +00:00
Automatically set correct ownership of QEMU state directories
* src/qemu_driver.c: Change ownership of /var/{lib,cache}/libvirt/qemu to match user/group that QEMU VMs are configured to run as.
This commit is contained in:
parent
182a80b922
commit
2a6825c393
@ -572,6 +572,21 @@ qemudStartup(int privileged) {
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (privileged) {
|
||||||
|
if (chown(qemu_driver->libDir, qemu_driver->user, qemu_driver->group) < 0) {
|
||||||
|
virReportSystemError(NULL, errno,
|
||||||
|
_("unable to set ownership of '%s' to user %d:%d"),
|
||||||
|
qemu_driver->libDir, qemu_driver->user, qemu_driver->group);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if (chown(qemu_driver->cacheDir, qemu_driver->user, qemu_driver->group) < 0) {
|
||||||
|
virReportSystemError(NULL, errno,
|
||||||
|
_("unable to set ownership of '%s' to %d:%d"),
|
||||||
|
qemu_driver->cacheDir, qemu_driver->user, qemu_driver->group);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (qemudSecurityInit(qemu_driver) < 0) {
|
if (qemudSecurityInit(qemu_driver) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user