Permission Denied when redirecting USB

Hello Forum,

I’m trying to migrate away from virt-manager and setting up VMs in LXC, the tutorial for Windows 10 works great! How to run a Windows virtual machine on LXD on Linux – Mi blog lah!

But I am hitting a minor issue when trying to redirect USB to my VM, when I select “USB Devices” and select my USB Drive, I get this error message:

How can I grant/assign/workaround this permission?

Many thanks,

Did a quick google on this. It is possible to configure udev rules.

To do this, run usb-devices, find the vendor ID, then add a udev rule for your USB device, in my case SanDisk USB.

T:  Bus=02 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#=  3 Spd=5000 MxCh= 0
D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
P:  Vendor=0781 ProdID=55a9 Rev=01.00  
S:  Manufacturer= USB
S:  Product= SanDisk 3.2Gen1                                                                                                                                                                                       S:  SerialNumber=0101602ee3e0066aedfdace9049b68ab9a9d4ad71b7ea3361ffe02094813ccbfa799000000000000000000006d9523e0ff813200a955810767acf91d
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=896mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage                                                                                                                                          
E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms

Create your rule, in my case I created 10-sandisk.rules:

cat /etc/udev/rules.d/10-sandisk.rules 
SUBSYSTEM=="usb", ATTRS{idVendor}=="0781", MODE="0666"
SUBSYSTEM=="usb_device", ATTRS{idVendor}=="0781", MODE="0666"

$ sudo systemctl restart systemd-udevd.service

Remove/re-insert your USB, add rediction, it should now work!

1 Like