virsh https://forum.ff.co.za/ en Allow users to run virsh and manage VMs https://forum.ff.co.za/documentation/allow-users-run-virsh-and-manage-vms <span>Allow users to run virsh and manage VMs</span> <span><span lang="" about="/user/jeff" typeof="schema:Person" property="schema:name" datatype="">Jeff</span></span> <span>Tue, 13/11/2018 - 06:59</span> <div class="layout layout--onecol"> <div class="layout__region layout__region--content"> <div class="body-padding field field--name-body field--type-text-with-summary field--label-hidden field--item"><nav aria-label="Book outline for Install QEMU-KVM on Debian 9" role="navigation"> <nav aria-label="Book outline for Install QEMU-KVM on Debian 9" role="navigation"> <p><strong>Table of Contents</strong></p> <ul> <li><a href="/documentation/install-qemu-kvm-debian-9">Install QEMU-KVM on Debian 9</a></p> <ul> <li><em><u><strong><a href="/documentation/allow-users-run-virsh-and-manage-vms">Allow users to run virsh and manage VMs</a></strong></u></em></li> <li><a href="/documentation/kvm-bridged-networking">KVM Bridged Networking</a></li> <li><a href="/documentation/kvm-virsh-console-access-debian-and-freebsd-vms">KVM Virsh Console Access for Debian and FreeBSD VMs</a></li> </ul> </li> </ul> </nav> <nav aria-label="Book outline for Elliptic Curve Crypto &amp; LetsEncrypt" role="navigation"> <ul></ul> </nav> <nav aria-label="Book outline for Managing qcow2 images" role="navigation"> <ul> <li> <ul> <li><a href="/documentation/managing-kvm-and-qcow2-images" hreflang="en">Managing qcow2 images</a></p> <ul> <li><a href="/documentation/backup-virtual-machine">Backup virtual machine</a></li> <li><a href="/documentation/copy-sparse-file-across-network-using-dd-or-rsync" hreflang="en">Copy sparse file across network using dd or rsync</a></li> <li><a href="/documentation/how-mount-qcow2-image-qemu-nbd" hreflang="en">How to mount a qcow2 image with qemu-nbd</a></li> <li><a href="/documentation/reclaiming-space-qcow2-disk-image" hreflang="en">Reclaiming space on qcow2 disk image</a></li> <li><a href="/documentation/resize-qcow2-blockresize-running-vm">Resize qcow2 with blockresize on running VM</a></li> </ul> </li> </ul> </li> </ul> </nav> <ul> <li><a href="/documentation/migrate-vm-minimal-downtime">Migrate a VM with Minimal Downtime</a></li> </ul> </nav> <nav aria-label="Book outline for Elliptic Curve Crypto &amp; LetsEncrypt" role="navigation"> <p>Sources:</p> </nav> <p><a href="https://libvirt.org/aclpolkit.html">https://libvirt.org/aclpolkit.html</a><br /> <a href="https://major.io/2015/04/11/run-virsh-and-access-libvirt-as-a-regular-user/">https://major.io/2015/04/11/run-virsh-and-access-libvirt-as-a-regular-u…</a><br /> <a href="https://www.poftut.com/use-virt-manager-libvirt-normal-user-without-root-privileges-without-asking-password/">https://www.poftut.com/use-virt-manager-libvirt-normal-user-without-roo…</a></p> <p>Defining custom rules requires creation of a file in the /etc/polkit-1/rules.d directory with a name chosen by the administrator (100-libvirt-acl.rules would be a reasonable choice). See the polkit(8) manual page for a description of how to write these files in general.</p> <p>We're going to allow members of the libvirt group to manage VM's:</p> <p><code>mkdir /etc/polkit-1/rules.d</code><br /> vi /etc/polkit-1/rules.d/100-libvirt-acl.rules</p> <p><code>polkit.addRule(function(action, subject) </code><code>{<br /> if (action.id == "org.libvirt.unix.manage" &amp;&amp; subject.local &amp;&amp; subject.active &amp;&amp; subject.isInGroup("libvirt")) {<br /> return polkit.Result.YES;<br /> }<br /> });</code></p> <p><strong>NB. Add to user's .bashrc:</strong></p> <p><code>export LIBVIRT_DEFAULT_URI=qemu:///system</code></p> <p> </p> <h2>Add bash completion library:</h2> <p>Download the bash completion library: <a href="https://github.com/LuyaoHuang/virsh-bash-completion/blob/master/virsh_bash_completion">virsh_bash_completion</a></p> <p>How to use it: Copy virsh_bash_completion file to /etc/bash_completion.d/ then restart bash.</p> <p>(<a href="https://github.com/LuyaoHuang/virsh-bash-completion">Source</a>)</p> <p> </p> </div> <div class="field field--name-field-category field--type-entity-reference field--label-above"> <div class="field--label">Category</div> <div class="field--item"><a href="/documentation" hreflang="en">Documentation</a></div> </div> <div class="fftags field field--name-field-tags field--type-entity-reference field--label-inline"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/tags/libvirt" hreflang="en">libvirt</a></div> <div class="field--item"><a href="/tags/virsh" hreflang="en">virsh</a></div> <div class="field--item"><a href="/tags/qemu-kvm" hreflang="en">qemu-kvm</a></div> <div class="field--item"><a href="/tags/polkit" hreflang="en">polkit</a></div> </div> </div> </div> </div> Tue, 13 Nov 2018 04:59:46 +0000 Jeff 127 at https://forum.ff.co.za KVM Virsh Console Access for Debian and FreeBSD VMs https://forum.ff.co.za/documentation/kvm-virsh-console-access-debian-and-freebsd-vms <span property="schema:name">KVM Virsh Console Access for Debian and FreeBSD VMs</span> <span rel="schema:author"><span lang="" about="/user/jeff" typeof="schema:Person" property="schema:name" datatype="">Jeff</span></span> <span property="schema:dateCreated" content="2018-06-18T12:11:56+00:00">Mon, 18/06/2018 - 14:11</span> <div class="layout layout--onecol"> <div class="layout__region layout__region--content"> <drupal-render-placeholder callback="flag.link_builder:build" arguments="0=node&amp;1=39&amp;2=bookmark" token="YuRzor9WIOotUYV2V4bznrkMFfGYtud55eXfuILRE0U"></drupal-render-placeholder><drupal-render-placeholder callback="flag.link_builder:build" arguments="0=node&amp;1=39&amp;2=like" token="dEqRm3NdgQAzonoVRZEUTDJRKjTAKiv9G6lRcTpltso"></drupal-render-placeholder> </div> </div> Mon, 18 Jun 2018 12:11:56 +0000 Jeff 39 at https://forum.ff.co.za