How to share files with Samba (SMB) from Ubuntu and mount on Windows

I am using a Windows 7 VM under KVM/QEMU, and there is no direct way – as far as I know – to make a shared drive between the host and guest, like the vboxsf that exists on VirtualBox hypervisor.

The best solution I found in order to share files between the host and the guest is to use Windows Sharing, or in other words: Samba (SMB).

We will do that with Nautilus.

You should follow these steps on the host (samba server) side:

  • Install samba: “sudo apt install samba nautilus-share”
  • Right-click on the folder you want to share and choose “Local Network Share”
  • Enable, give it a name, and allow read/write if you wish to
  • Click Create Share
  • Run “sudo smbpasswd -a any_username“, you could just use the same account in linux, but take care that the SMB password set is not the same password used in your system

On the guest (Windows VM), you need to apply the following (make sure that the samba ports are open in your firewall):

  • Right-click on “Network” and choose “Map network drive”
  • Choose a drive letter
  • Add the folder in this way: \\SERVER_IP\shared_folder_name
  • It should prompt you for a username and password
  • Type as the username “COMPUTER_NAME\user_name“, where user_name is the any_username used when you ran the command smbpasswd above
  • Type the password and there you go!
  • Enjoy!

Sources:

  1. https://help.ubuntu.com/community/How%20to%20Create%20a%20Network%20Share%20Via%20Samba%20Via%20CLI%20%28Command-line%20interface/Linux%20Terminal%29%20-%20Uncomplicated%2C%20Simple%20and%20Brief%20Way%21
  2. https://help.ubuntu.com/community/Samba/SambaClientGuide
Advertisements

About SoCRaT

Research Support and Infrastructure Engineer, OSS & Linux Geek
This entry was posted in Linux, Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s