0

We have a virtual win7 machine that needs to be rebooted remotely from time to time. We created a restricted user account with the shell set to rbash so a user can ssh in and reboot the virtual machine via virsh when needed.

user@machine:~$ echo $SHELL
/bin/rbash
user@machine:~$ virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # list
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied

virsh and virt-top do run, but the user can't do anything inside virsh. How can we allow this user to run virsh commands from an rbash shell?

1
  • I think this is not rbash related, but an ordinary permission-problem. The user in question has to have read/write permissions on the socket it tries to open. Mar 21, 2016 at 16:55

2 Answers 2

1

Andreas is correct, it is not an rbash problem; adding user to the group libvirtd solves the problem.

2
  • FWIW, as an alternative to the ssh + rbash approach you could simply connect remotely to libvirtd via virsh - see e.g. libvirt.org/uri.html and especially the section about remote URI's: libvirt.org/uri.html#URI_remote
    – doktor5000
    Mar 22, 2016 at 7:45
  • The comment from @doktor5000 should be the accepted answer.
    – John
    Mar 23, 2016 at 15:35
0

Adding my comment as an answer, as using ssh to connect to the host, and then using a dedicated user running rbash seems only a workaround to me.

As a less hackish alternative to one could simply connect remotely to libvirtd via virsh.
See e.g. https://libvirt.org/uri.html and especially the section about remote URI's

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .