I'm trying to set up a folder that can be accessed via Windows clients over the net on my Linux VPS on which our companies website resides.

I know a little bit about Linux, and have used Samba before to browse Windows shares from a Linux laptop. I'm guessing it's possible to do the reverse - to share a folder from Linux TO a Windows client.

I have root SSH access to the VPS, would anyknow know what steps I need to take to set up the share, and how I can secure it, ideally with a simple username/password so the Windows clients can connect easily?

Many thanks,


  • 1
    My instincts tell me this is a dangerous thing to do on the public internet; if it is done within a VPN then no problem. – PP. Feb 24 '10 at 16:54

Most ISP's block SMB traffic at their routers-so more than likely your clients won't be able to mount the share from outside the VPS providers network.

Configure these lines in smb.conf to setup a Samba share

comment = Insert a comment here
path = /home/share/
valid users = tfox carole
public = no
writable = yes
printable = no
create mask = 0765

I'm not so sure using Samba over the internet is very safe, but I have set up sharing with Samba from a Linux machine and documented my steps and I'll share that with you.

First off, you're gonna need to open up a couple of ports in your firewall. 137 UDP, 138 UDP, 139 TCP, 445 both UDP & TCP

Next, edit your settings and define your shares in the /etc/samba/smb.conf file*
Here's mine:

\#======================= Global Settings======================  
    workgroup = MYGROUP
    server string = Samba Server Version %v  
    netbios name = NAS  
    hosts allow = 127. 10.  
    security = user  
    passdb backend = tdbsam  
\#====================== Share Definitions =====================  
    comment = Public  
    path = /shares/Public  
    public = yes  
    guest ok = yes  
    writable = no  
    printable = no  
    comment = upload  
    path = /shares/Public/upload  
    public = yes  
    guest ok = no  
    writable = yes  
    printable = no  
    valid users = myusername

* location may vary according to distro, I used CentOS

Now obviously your "hosts allow" section should be adjusted to allow your client. Some security measures are in place in this example config, so that the upload folder is only accessibly by 'myusername', which is a linux user account on the server. The public folder however is wide open to everyone, although it is read-only.

If your smb service is running and the right firewall ports are open, this should work.

Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy