• subscribe
  • twitter

VirtualBox Exploit – How to Share your USB key between Ubuntu and Windows

A simple way to share your files between your Ubuntu Desktop and Windows is by using Samba file sharing. It creates a common “workgroup” with Windows that makes file transfer between these two systems easy to carry out. Now, if you use VirtualBox (the open source answer to visualization, and also direct competitor to the rather costly VMware Workstation and Parallel) to expand your PC by running multiple operating systems, with Ubuntu as host and Windows XP as guest, then you can also use Samba to resolve any file sharing issue (if you have one).

If in any of the above mentioned systems, you intend sharing your USB key with the rest of the system then you can use this alternative method. This method consists of mounting your USB key into your “Samba shared folder"this way it becomes simultaneously available for both Ubuntu and Windows. If you know how to get this done, then you can stop reading here, else this what you can do;

Installing Samba
To install Samba from a terminal type; sudo apt-get install samba smbfs

Configuring Samba
After installing Samba, you’ll have configure the smb.conf file;
sudo gedit /etc/samba/smb.conf

Most of the lines in this file can be left as they are. The following lines are the ones that are really important to our task, so change or add or uncomment (remove the 😉 them as needed:

#====== Global Settings ======#
workgroup = {your Windows Workgroup}
server string = %h server (Samba, Ubuntu)
dns proxy = No

####### Authentication #######
security = user
username map = /etc/samba/smbusers

Creating a Samba User.
You’ll have to edit the /etc/samba/smbusers file if you want to give certain users special access to the computer. There are several ways of doing this; You can simply make your current user_name become your samba_user_name by editing the smbusers file. sudo gedit /etc/samba/smbusers.
Therein type username = “samba_user_name”.
(In my case my Ubuntu user_name is martin, that became my samba_user_name, so my smbusers file looks like this martin = “martin”
Then using the smbpasswd utility put a samba password on your new samba-user_name sudo smbpasswd -a samba_user_name

Run Samba
One last step, Samba must be restarted.
/etc/init.d/samba restart

Now, you have Samba configured and running. To create a shared folder, go to System -> Administration -> Shared Folders. Click Add
to open the Share Folder windows. In Share through choose Windows network (SMB). This newly created shared folder will be accessible from both Ubuntu and Windows systems – Restart Windows to see this changes.

What we wanted to do from the start was to share our USB key with both systems simultaneously, each time we load it. As said above, simply change the mount point of your USB key from /media/disk(Ubuntu) to the Shared Folder. (In my case I created a folder called usbkey under shared olders /home/martin/sharedfolder/usbkey).

Changing the mount point of your USB Key.
You’ll have to edit fstab by doing sudo gedit /etc/fstab. Modify or add this line /dev/sdb1 /put_the_path_to_shared_folders auto defaults,users,noauto 0 0
(change the path to your shared folders, leave the rest intact) where sdb1 is the name given to your USB key by your filesystem. If you do not know what name your system assigns to your USB key, load your pendrive then go to System -> Administration -> System Monitor. In the File system flap, you’ll see under “Device” your key’s name.

What next; Your USB key will load into your shared folders and this in turn will make it accessible for both systems.