Accessing USB devices from VirtualBox

Submitted by olaf on 2016-08-14

Today, I stumbled again over a USB device not recognized by VirtualBox.

In order that VirtualBox can access a device, VirtualBox (i.e. the user running it) must have the necessary permissions.

This means, that the user running VirtualBox must be the owner of the device, member of the group of the device or must have access as other.

To check for these conditions, you must first locate the device with lsusb

$ lsusb
...
Bus 005 Device 002: ID abcd:1234 Acme Corp. Gadget
...

and then look for the permissions of the device

$ ls -l /dev/bus/usb/005/002
crw-rw-r-- 1 root root 123, 456 Aug 14 16:09 /dev/bus/usb/005/002

In this case, only root can access the device.

To make it accessible for my account,

  • I can change the owner

      # chown olaf /dev/bus/usb/005/002
    
  • change the group

      # chgrp olaf /dev/bus/usb/005/002
    
  • or allow everybody to access the device (which might be risky)

      # chmod a+rw /dev/bus/usb/005/002
    

The usual advice, to add your account to the group vboxusers,

# adduser olaf vboxusers

works only, if the group of the device is already set to vboxusers

$ ls -l /dev/bus/usb/005/002
crw-rw-r-- 1 root vboxusers 123, 456 Aug 14 16:09 /dev/bus/usb/005/002

which might be done explicitly with chgrp or implicitly by some udev rule.

Post a comment

All comments are held for moderation; Markdown and basic HTML formatting accepted. If you want to stay anonymous, leave name, e-mail and website empty.