How to enable KVM shared folders from cli

I need to exchange files between my host (Debian) and Whonix-Workstation. I use KVM. The best option should be KVM shared folders, right (http://www.whonix.org/wiki/KVM#Shared_Folders)?
However, I use a headless server and the guide only shows the GUI way to enable shared folders. Please help.

Is there anybody who can help me out?

https://www.whonix.org/wiki/Free_Support_Principle applies. This can be figured out using a non-Whonix VM. I.e. for example a Debian VM.

Maybe I asked my question too vague, because I am pretty sure that the community can answer my question:
How to share files under KVM on a headless server (Host <—> Workstation)?

How to create KVM shared folders on the cli

Notice: Replace <user_name> with your host user name.

  1. Edit the Whonix-Workstation XML file:
sudo virsh -c qemu:///system edit Whonix-Workstation
  1. Add the flowing lines inside the <devices></devices> tag:
<filesystem type='mount' accessmode='mapped'>
    <source dir='/home/<user_name>/shared'/>
    <target dir='shared'/>
  1. Create a shared folder on the host:
mkdir /home/<user_name>/shared
  1. Set correct permission for the folder
sudo chmod 777 -R /home/<user_name>/shared
  1. Restart the Whonix-Workstation
sudo virsh shutdown Whonix-Workstation
sudo virsh start Whonix-Workstation
  1. Login to the Whonix-Workstation
sudo virsh console Whonix-Workstation
  1. Create a test file inside the shared folder mounted at /mnt/shared
cd /mnt/shared
nano test-from-guest
  1. Logout from Whonix-Workstation
STRG + ALT + 5
  1. Check for the file
cd /home/<user_name>/shared

You should see your created test file.

Question: Is there a better option without the <user_name>? Because, this can be considered a leak, right?

[Imprint] [Privacy Policy] [Cookie Policy] [Terms of Use] [E-Sign Consent] [DMCA] [Contributors] [Investors] [Priority Support] [Professional Support]