Virsh as an other User


Dargor

Recommended Posts

Hello all, i hope this is the right place to post this.

So before 6.9 beta 25 i was running this script at startup :
#!/bin/bash
chown "username":users /etc/ssh/"username".pubkeys
echo ""username" ALL=(root) NOPASSWD: /usr/sbin/virsh domstate *, /usr/sbin/virsh start *, /usr/sbin/virsh shutdown *">>/etc/sudoers.d/vmc
chmod 0440 /etc/sudoers.d/vmc
mkdir /home/"username"
this allowed me to run the virsh commands as the "username" user.

After updating to 6.9 beta 25 i noticed that it no longer works, in an attempt to debug this i tried this command:

sudo -u "username" virsh domstate "vmname" and i get the following error:
error: failed to connect to the hypervisor
error: Cannot create user runtime directory '/.cache/libvirt': Permission denied

is there something i can do to be able to run this command as this user again?

Thank you in advance for your time and sorry if this is not the correct place to post 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.