How can I enable access to USB devices within VirtualBox guests?
In order to enable access to these devices you'll need to add your username to the group
$ sudo usermod -a -G vboxusers <username>
$ sudo usermod -a -G vboxusers saml
You can confirm the change afterwards:
$ groups saml saml : saml wheel vboxusers wireshark
After doing the above you'll want to logout and log back in, so that for the newly added group to get picked up by your user account. Then from the VirtualBox GUI you'll be able to right click on the USB icon in the lower right group of icons, and select whatever USB devices you want to give control over to your running guest VM.
Detecting USB devices
You can use VirtualBox's little known command line tool VBoxManage to list out the USB devices that are accessible. This is a good way to also confirm that the group addition made above to your username are being picked up correctly.
$ VBoxManage list usbhost Host USB Devices: <none>
$ VBoxManage list usbhost | head -19 Host USB Devices: UUID: abcd1234-123a-2345-b1e0-8a0b1c1f2511 VendorId: 0x046d (046D) ProductId: 0x0809 (0809) Revision: 0.9 (0009) SerialNumber: ABC34567 Address: sysfs:/sys/devices/pci0000:00/0000:00:12.2/usb1/1-4//device:/dev/vboxusb/001/004 Current State: Busy UUID: d2abc46d-123-1234-b8c3-691a7ca551ce VendorId: 0x046d (046D) ProductId: 0xc504 (C504) Revision: 19.16 (1916) Manufacturer: Logitech Product: USB Receiver Address: sysfs:/sys/devices/pci0000:00/0000:00:12.0/usb3/3-3//device:/dev/vboxusb/003/003 Current State: Busy ...
And before that you need to make sure that you have the host and guest support for USB. Do all distributions use a `vboxusers` group?
@Gilles - yes the group is specific to virtualbox. Ubuntu shows the same method here: https://help.ubuntu.com/community/VirtualBox/USB
@Gilles - FYI, I just confirmed this on Ubuntu as well. When you say host/guest support for USB do you mean within the guest's settings, enabling the USB controller?
@CodeMed - VBoxManage isn't its own RPM that you install like that, it's part of another RPM. Do a `repoquery -qf */VBoxManage` to find out what package it's included in and do a `yum install X` of that package instead.
@CodeMed - that means that none of the repos you have access to have VirtualBox (as an RPM) available. I typically do something like this on CentOS/Fedora: http://www.if-not-true-then-false.com/2010/install-virtualbox-with-yum-on-fedora-centos-red-hat-rhel/.
@CodeMed - Sorry you confused me when you were attempting to install it w/ `yum install VboxManage`. If your issue is w/ Windows 8.1 + VirtualBox that isn't really on-topic on this site, it should be asked on Super User.
Still perfectly working with Ubuntu LTS 14.04 and VirtualBox 4.3.36. Under Ubuntu (and not only I suppose) it is possible to do even `sudo adduser USERNAME vboxusers` to add _USERNAME_ to the _vboxusers_ group as suggested by the same second link slm provided. (Syntax `adduser [options] user group`),
I was assuming that they were all to be executed from the same place, it just wasn't clear which place. I'm particularly interested in `sudo usermod`.
@nobar - yes the commands in my answer were all run on the physical host, not inside the VM.
Just want to add this still works perfectly with Ubuntu LTS 16.04 (as host) and VirtualBox 5.1.22
your "without group" example is how my googling brought me to this perfect answer. Way to make it both directly to the point /and/ thorough!
I see my USB in `dmesg --follow` when attached but not in `VBocManage list usbhost` :(