On running gui applications as root

Joonas Sarajärvi muep at iki.fi
Tue Nov 17 17:55:47 UTC 2015


Hi,

2015-11-17 19:30 GMT+02:00 Andrew Haley <aph at redhat.com>:
> And I have no idea how to run things like virt-manager without root.

My impression is that by default in fedora, virt-manager runs as
non-root. I guess it might ask for the root password in order to
manage the libvirtd that runs as privileged mode, but even in that
case the user interface would run as your normal user.

My system has been set up to allow my user to manage VMs in the
system-wide libvirtd instance by adding this content to a file named
/etc/polkit-1/rules.d/20-libvirt-polkit.rules:

polkit.addRule(function(action, subject) {
        if (action.id == "org.libvirt.unix.manage") {
                if (subject.user == "muep") {
                        return polkit.Result.YES;
                }
        }
});

Of course this does not necessarily let you avoid all cases where
you'd run an X11 application as root. But virt-manager seems to be
written with the intent that it does not require to be run as root.

- Joonas


More information about the devel mailing list