How to Access USB from VirtualBox Guest OS
There are times when you need to access USB from VirtualBox. For instance, you installed Kali Linux in VirtualBox and a USB wireless network adapter is required to do penetration testing. This simple tutorial will show you how to easily access your USB thumb drive, USB hard disk, or USB wireless network adapter in your Virtualbox guest OS.
It’s assumed that you have already set up VirtualBox on your host OS.
Step 1: Install Virtualbox Extension Pack
Shut down your guest OS.
VirtualBox by default only supports USB 1.x devices. VirtualBox extension pack includes support for USB 2.0 and USB 3.0 devices, VirtualBox RDP and PXE boot for Intel cards. You must install the extension pack with the same version as your installed version of VirtualBox.
To check the version of your VirtualBox, open VirtualBox manager, then go to Help
> About VirtualBox
. Once you know the version number, go to http://download.virtualbox.org/virtualbox/ in your web browser to download VirtualBox extension pack which ends with .vbox-extpack
extension.
Once downloaded, in VirtualBox manager go to File > Preferences > Extensions. Click the add button to add VirtualBox extensions pack from your hard disk.
Once you choose the extension pack, click Install
button to install it. You can see what functionalities it adds to your virtual machine in the description.
Then click Agree
to accept VirtualBox license.
So now Virtualbox USB support is enhanced.
Step 2: Add Your User to vboxusers Group
In order for VirtualBox to see your USB devices, your user must be in the vboxusers
group. Open up a terminal window (Ctrl+Alt+T), then run the following command. Replace your-username
with your real username. (I assume your host OS is a Linux distro such as Ubuntu, instead of Windows).
sudo gpasswd -a your-username vboxusers
Now log out and log back in so the changes can take effect. To check which groups your user account belongs to, run:
groups yourusername
If you still aren’t in the vboxuser
group, then restart your computer.
Step 3: Enable USB Controller and Add New USB filter
Click settings
for your virtual machine.
Select USB
on the left pane. Then choose USB 2.0 controller or USB 3.0 controller. Note that you can only enable one type of controller. Next, insert your USB device to your host machine and click the add button to add new USB filter.
Choose your USB device and Click OK.
Step 4: Access USB from VirtualBox
Now boot up your virtual machine and you will see your USB device in the guest OS. It should be noted that your host OS won’t be able to see the USB device while it’s being used by VirtualBox.
To unmount USB device from guest OS, select devices
> USB
and uncheck your USB device.
To mount USB in VirtualBox again, simply select your USB drive in the list.
How to Boot VM From USB Stick
Let’s say you created a bootable USB stick and you want to boot your VirtualBox VM from the USB stick. Virtualbox allows your VM to access raw hard disk, by creating a special VMDK image. I assume your host OS is Linux.
First, find the device name of your USB stick.
lsblk
Mine is /dev/sdb
. Then run the following command to create a VMDK image file /tmp/usb.vmdk
.
sudo VBoxManage internalcommands createrawvmdk -filename /tmp/usb.vmdk -rawdisk /dev/sdb
Change the ownership of this file. Replace username with your real username.
sudo chown username:vboxusers /tmp/usb.vmdk -R
Then add your user account to the disk
group, so you can access raw hard disk.
sudo adduser username disk
Log out and log back in for the changes to take effect. Then open Virtualbox and attach the raw disk (/tmp/usb.vmdk
) to your VM.
Wrapping Up
Does this post helped you access USB drive in VirtualBox guest OS? Let me know in the comments section below. As always, if you found this post useful, subscribe to our free newsletter or follow us on Google+, Twitter or like our Facebook page.
I was not getting access to my USB drive in Virtual Box. According to your above tutorial I followed all the instructions and now it is observed that my pendrive is detected by Virtualbox. However, my guest OS is Windows 7 in Virtualbox. In the My Computer folder of Windows 7, the USB device is yet to detected and thus I’m still hanging in air!
The same here
Ι have a Kingston data traveler 8gb
My host is in Ubuntu and the client where i want to use the usb is running windows 7
Even though it is shown in the usb l list of the client vm properties, it is not shown in my computer
In windows 7 guest operating systems you need to install intel usb 3.0 drivers for win 7
https://downloadcenter.intel.com/download/21129/USB-3-0-Driver-Intel-USB-3-0-eXtensible-Host-Controller-Driver-for-Intel-7-Series-C216-Chipset-Family?product=65855
Should take care of your issue.
I am using the Alfa AWUS036ACH. No matter how hard I try I cannot get Kali to recognize the wireless interface. I am on Windows 10 and using Virtual Bx 5.2.22. What is strange is that the output of lsusb sees the adapter. When I click on devices on top in the Kali windows it says I am connected to he Realtek 802N adapter which is the correct chipset. However, when I issue the command iwconfig, or ifconfig, it doesn’t show WLAN0. I don’t get it. When I disconnect the adapter from the guest machine (Kali), then the adapter shows up on the host machine. I have googled s many solutions and none of them work. Am I missing something?
This solution worked perfectly for me. I am running Ubuntu 18.10 as host and windows 7 as guest in Virtualbox. Am now able to see and use my Ross-Tech VCSD diagnostic interface. Thanks for the info.
Help please, I have tried everything (I have Windows 7 guest in a Ubuntu 16 host), I got the right extension pack and guest addittions, I am a Vboxusers member (I dont know how to log in and log out using the terminal but I did switch off and on my computer) Still USB are not being detected no my virtual machine, hope you can help me folks, thanks in advance.
Thanks for this tutorial, worked perfectly.
UR FIRST STEP ..IN THE INDEX .VBOX EXT PACK IS NOT THERE PLS HELP….
You need to select the Virutalbox version number first.
Excellent! Made me feel like I knew what I was doing!
This is very informative and interesting post.
Great! for Virtual Box 6.0, it doesn’t need step , others are perfect!
thanks
Very helpful guide. I just wanted to point out that on Ubuntu 20.04 (Focal) I actually had to completely reboot in order to become part of the `vboxusers` group after adding myself. Then I was able to enumerate the USB devices on the host in VirtualBox! +1
Indeed, this was the fix for me too (Vbox 6.1 on Ubuntu 20.04 with Win 10 guest).
I also could not see the devices until I rebooted my computer as well!! Thank you so much Thomas. I , This also worked for me on VirutalBox 6.1.30 on Ubuntu 21.10. I tried everything for two days until I read your post. May the author be able to verify and update the article? Excellent article!
What are the instructions if the host OS is Windows 10 and the Guest OS is Ubuntu Linux?
I am also struggling to find this information.
However, I just skipped this step (adding user to vboxusers group) and went ahead and it worked!
These instructions are right. Thanks Linux babe.
Ubuntu 20, Virtualbox 6.1
this article really helpful.thank you so much.
Thanks for your help, it worked.
Always ran VMs with Windows/Apple as the host. First time with Ubuntu. I was going nuts trying to figure this out. Thanks!
NOTE: After Step 2 of adding the user to the vboxusers group, There should be an additional step for one TO REBOOT THEIR SYSTEM (or at least try logging out) afterward. The virtualbox forums also say this: https://forums.virtualbox.org/viewtopic.php?f=35&t=82639
“For Linux hosts, please make sure that you are a part of the “vboxusers” group and verify your membership with the “id” command, after a logout or a reboot. Otherwise you will not see any USB devices. Also remember that only the official download from VirtualBox is supported, not your distro’s.”
Thank you. Works! Just used
sudo usermod -a -G vboxusers $USER
instead of
sudo gpasswd -a your-username vboxusers
Kali guest – MX KDE host – VirtualBox 7.0
I recently dumped Windows for Linux (MX KDE) after almost 35 years of writing apps and using. I had a Kali guest VirtualBox on Windows that worked fine but on Linux would not see my USB printer setup for my old HP1100. I scoured the Internet for over a day. I messed with CUPs, etc. to no avail. I was about to give up and go to plan B – print to a file and do a share or do a dual boot with Windows then I found this tutorial. It leaves nothing to my imagination and shows all of the steps needed to fix my problem without assuming I know anything. VERY MUCH APPRECIATED!!!
Just reboot the host operational system after all steps bellow.
Thanks for the very succinct explanation. Every time I upgrade virtual box, I struggle with this and now hopefully I will remember.