Ubuntu – How to share samba via Open VPN? Is that possible

networkingopenvpnsambaservervpn

I have configured open VPN in my home so that it can be accessible from my office easily.

Now I want to share samba via my open VPN. How can I share samba over open VPN between Ubuntu and Windows?

Home public IP: HHH.OOO.MMM.EEE
Home desktop IP: 192.168.10.10
Office public IP: OOO:FFF:III:CCC
Office Windows desktop IP: 192.168.1.10

Best Answer

  • In short: Make sure that samba accepts connections from the VPN subnet.

    In more detail (from the OpenVPN wiki):

    Next, edit your Samba configuration file (smb.conf). Make sure the hosts allow directive will permit OpenVPN clients coming from the 10.8.0.0/24 subnet to connect. For example:

    hosts allow = 10.66.0.0/24 10.8.0.0/24 127.0.0.1
    

    If you are running the Samba and OpenVPN servers on the same machine, you may want to edit the interfaces directive in the smb.conf file to also listen on the TUN interface subnet of 10.8.0.0/24:

    interfaces  = 10.66.0.0/24 10.8.0.0/24
    

    If you are running the Samba and OpenVPN servers on the same machine, connect from an OpenVPN client to a Samba share using the folder name:

    \\10.8.0.1\\sharename
    

    (10.66.0.0 is the home subnet in their example, 10.8.0.0 is the VPN subnet)

    Afterwards, restart the samba service to take the new configuration into account:

    sudo service smbd restart
    
  • Related Question