Ubuntu has become one of the most popular Linux distributions out there. This is a part of mini-series on how to leverage Ubuntu to share files between Windows and Ubuntu. In this guide we will look at different ways to mount Windows shares in Ubuntu. We will use a general command line method, as well as an alternative GUI method through virtual machine to auto mount host machine shares. For the purpose of illustration, we will use VirtualBox as the virtual machine application, it’s free and available for all major platforms.
Option One: Map Windows Host Machine Share folder in Ubuntu
If you are running Ubuntu inside a virtual machine (chances are most people run linux inside a VM) there are existing tools you can leverage to help you mount shares between host machine and the virtual machine. If all you want is to able to access files both ways this is how you can do it. In VirtualBox, before you boot up the server. Go to Devices > Shared Folders Settings
Select the folder you’d like to share with Ubuntu, and check “Auto-mount” and “Make Permanent”.
Now when you login into Ubuntu, launch Terminal and type
mount you will see a list of network shares mounted to the system. The “Download” directory that we previous added through VirtualBox share folders option is listed under /media/sf_Downloads
Option Two: Mount A Windows Network SMB Share Through Command Line
If you also want to map Windows smb network shares inside Ubuntu, you can also do the following on the command line. First install mount.cifs utility command if you don’t have it installed. Then create a directory under /mnt mount directory.
sudo apt-get install cifs-utils
sudo mkdir /mnt/sharename
sudo mount.cifs //hostname/sharename ~/mnt/sharename -o user=username pass=password If the smb network share doesn’t support guest access, then you need to pass the active directory or account username and password as the additional options. Replace “hostname” and “sharename” to the appropriate network on your system. This is it, two options to help you get started using Ubuntu while have complete access to files from Windows environments.