Share a folder between Linux host and Windows guest VM

6,593

The problem was that the Firewall was blocking the connections on the ports used by Samba.

I had to add the necessary exceptions and now it works as expected.

Share:
6,593

Related videos on Youtube

Sekhemty
Author by

Sekhemty

_

Updated on September 18, 2022

Comments

  • Sekhemty
    Sekhemty almost 2 years

    I'm trying to share a folder between my main OS (openSUSE 42.1) to a guest Windows 7 virtual machine, but I'm unable to set it up properly.

    I access the VM from virt-manager, and I've read that the best way to accomplish this is to use Samba.

    I've added this section to my /etc/samba/smb.conf

    [shared]
        comment = my shared folder
        guest ok = Yes
        inherit acls = Yes
        path = /home/user/shared
        read only = No
        browseable = Yes
    

    and I set the permissions of /home/user/shared to drwxrwxrwx, and made sure that smb.service is up and running.

    But when I run the Windows VM and I try to connect to the shared folder, I can't neither access or even see it.

    How can I solve this?

    • Centimane
      Centimane almost 8 years
      can you navigate to the samba share using a web browser? Try opening a web browser and as the URL use: smb://[hostname of Linux host]. If you don't have a DNS then you can use the IP of the Linux host instead.
    • Sekhemty
      Sekhemty almost 8 years
      No, I can't navigate to it from the Web browser. I was trying to mount it from the file browser not from the console
    • Centimane
      Centimane almost 8 years
      If you cannot navigate to it using the web browser the issue is the smb server. Your conf file looks fine, so check out the status of the smb service. What does service smb status tell you? Can you also post your full smb.conf? The [global] section may be the culprit (though I doubt it)
    • Sekhemty
      Sekhemty almost 8 years
      I can access smb://MyLinuxHost from a web browser inside Linux, does it make any difference?
    • Centimane
      Centimane almost 8 years
      Yes, that sounds like the smb server is working fine. Can you ping the Linux server from the windows one? Do you have firewalld or iptables turned on? Both of those block ports and can restrict incoming connections
    • Sekhemty
      Sekhemty almost 8 years
      I tried to disable the firewall and now it works. I've added the required exceptions and now it is all correctly set up. Thank you!
  • johnd
    johnd over 4 years
    Now 2 months later I had to install MS Teams on Win7 VM, 2 weeks ago. It worked (for a while) but broke Samba sharing. Today Teams broke too. I can ping virbr0 (from Linux and Windows), nmbd/smbd servers are running, testparm has no errors. Windows side mostly fails -- can ping external sites (google) from CLI but not a browser. On Linux it all works; netstat --inet -nlp shows virbr0 to VM (port 139, 445) in Listen. Been debugging for hours, no luck. Nothing was changed in smb.conf when it broke - errors are on Windows side, and only post-Teams. Uninstalling Teams didn't fix it. Ideas?