[CentOS] kvm as non-root user

Sat Jul 3 12:17:42 UTC 2010
David McGuffey <davidmcguffey at verizon.net>

On Sat, 2010-07-03 at 07:58 -0400, David McGuffey wrote:
> Yes, I already get that output.  I also made sure that the xml scripts
> and the VM images are not root:root, but root:kvm.
> 
> I'm using the Virtual Machine Manager GUI as the interface...that is
> where I get challenged for the root pw.  Maybe I need to go to create a
> script that runs qemu-kvm as the regular user to start the VMs.
> 
> Dave M
> 
> On Fri, 2010-07-02 at 18:09 +0530, Arun Khan wrote:
> > On Fri, Jul 2, 2010 at 4:24 PM, David McGuffey
> > <davidmcguffey at verizon.net> wrote:
> > > Tried as I might, I cannot get kvm on CentOS 5.4 to run as a non-root
> > > user.
> > 
> > Post the error message.
> > 
> > > Have Googled and followed guidance I've found (put the regular
> > > user in the kvm group, change permissions on several files, etc.).
> > >
> > > Anyone have decent (e.g., working) guidance on how to do this?
> > 
> > The output of "ls -l /dev/kvm" should be like this:
> > 
> > crw-rw----+ 1 root kvm 10, 232 2010-07-02 09:27 /dev/kvm
> > 
> > I have not had to do anything special as long as the non root user is
> > member of "kvm" group.
> > 
> > HTH
> > -- Arun Khan
> >

In /usr/bin, here is what I find.

-rwxr-xr-x 1 root root       9230 Apr  2 22:31 virt-clone
-rwxr-xr-x 1 root root      10322 Apr  2 22:31 virt-convert
-rwxr-xr-x 1 root root      12000 Apr  2 22:31 virt-image
-rwxr-xr-x 1 root root      34482 Apr  2 22:31 virt-install
lrwxrwxrwx 1 root root         20 May 16 22:34 virt-manager
-> ../bin/consolehelper
-rwxr-xr-x 1 root root      34040 Sep  3  2009 virt-viewer
-rwxr-xr-x 1 root root       3505 Mar 31 05:02 virt-xml-validate

And looking through the virsh manual, here is what I find:

Most virsh commands require root privileges to run due to the
communications channels used to talk to the hypervisor.  Running as non
root will return an error.

Seems all paths to managing VMs has to go through root.

Dave M