Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I recently built a small server machine, using Ubuntu Server and Samba, to act as a file server (among other things) so that my entire family can access certain files over the network from Windows machines. However, I would love to take this a step further and have the shares be accessible over the internet, away from home. How would I do this? I know very little about how the Windows network shares system works, so I have no idea where to start.

share|improve this question
    
You really should use SCP. –  kzh Jul 17 '11 at 21:53
    
@kzh: That's a little too complex for some of my family members. –  Sasha Chedygov Jul 17 '11 at 21:55
    
WinSCP has Win Explorer integration: winscp.net/eng/docs/integration –  kzh Jul 17 '11 at 21:57
    
@kzh: Well the whole point is to avoid having to install software to get it to work. Without that constraint, I would just use a VPN. –  Sasha Chedygov Jul 17 '11 at 22:01
1  
@KCotreau: There is a lot more to this question that I left out for the sake of simplicity. Let's just say that the data that we will be exposing is not in any way sensitive. I understand and accept the security risks--I just wanted a simple answer to my specific question. –  Sasha Chedygov Jul 18 '11 at 0:39

3 Answers 3

up vote 3 down vote accepted

With Samba, you need to expose ports 139/tcp and 445/tcp to the outside – usually this involves configuring "port forwarding" in your router. Additionally, you must make sure that your external IP address is pingable from the outside.

After this, you'll be able to access the shares by entering \\youraddress in Explorer's address bar or in Start - Run. (Here youraddress is either your external IP address or your DNS name, if you have one.)

Note, however, that the CIFS protocol used by Windows file sharing does not provide data encryption (so anybody with a packet sniffer can monitor your file transfers), and its authentication is not especially strong either.

Also note that Windows machines by default remember the login credentials for the entire local session. Unless you're connecting to Samba as "Guest", you must take special care on public machines: always use net use \\address before opening in Explorer / net use \\address /del to disconnect. (This is not needed on personal computers.)

For some extra security, add the following to general section in smb.conf:

LANMAN auth = no
NTLM auth = no
invalid users = root
share|improve this answer
1  
Preemptive comment: CIFS/SMB is a good protocol. It's the Microsoft Windows server-side implementation that is one big security hole. None of the Windows SMB exploits apply to Samba servers. –  grawity Jul 17 '11 at 20:48
    
Huh, I figured it would be much more complex than that. Thank you for the advice! –  Sasha Chedygov Jul 17 '11 at 21:48
1  
On a side note, do you have any recommendations for making the lack of data encryption less of an issue? I trust all of the networks I connect to, but I might want to, for example, make an account for my girlfriend (who may be on a non-trustworthy network), so she can access my music/photos/etc. I could always just give her a read-only account and call it good, but I'm just wondering if you have some more specific advice perhaps. Thanks again! –  Sasha Chedygov Jul 17 '11 at 21:52
    
For read-only access, you could set up a HTTPS server (StartSSL/CAcert). To upload files, this could be extended to WebDAV...but Windows won't use WebDAV if CIFS is available, and most Windows versions have some problems with SSL-secured WebDAV. Other solutions require external software (SFTP using WinSCP) or even VPN configuration. –  grawity Jul 17 '11 at 22:02
1  
Just a note: with Canadian ISPs, the SMB ports are blocked unless you have a business account. Make sure your ISP unblocks the ports if you're using JUST SMB –  Canadian Luke Jul 18 '11 at 0:29

It depends on what kind of files you intend to serve. If these are documents, or just files you need to access remotely, just run an FTP server on your Ubuntu server. Make sure you secure it well, with good passwords, and access to just the file directory, and not the root.

If however you intend to stream media files (songs, movies), you're looking at running a streaming server. There are plenty of solutions for that (here's one).

Finally, you could always use an existing "cloud" drive solution like Dropbox or SkyDrive, or Amazon Cloud Player - just synchronize your files with one of those services and internet access (a speedy one at that) is guaranteed.

share|improve this answer

If your family can handle using WinSCP then:

  • install and setup SSH
  • give your family members local accounts on your server
  • symlink your file store into these directories. For example, if you are exposing /srv/samba_files through Samba, you'd want to do an ln -s /home/{user}/files /srv/samba_files or similar for each account. If you have to do this for many accounts you could write a script to do it.
  • install WinSCP on your family's computers

You'll then have a very secure method of transferring files that isn't too difficult to use.

However, if you really want the "network drive" integration with Windows, I'd learn about OpenVPN and then setting up a bridged tunnel to your home network. I've successfully gotten Windows fileshares to work over such tunnels.

You can also use PoPToP (pptpd) to allow a Windows system to connect back to your Ubuntu box via a PPTP vpn. (An IPSec/L2TP tunnel would provide better security but it is difficult to setup).

share|improve this answer
    
Why not just create a files share pointing to /srv/samba_files directly? –  grawity Jul 17 '11 at 21:59
    
Samba shares would only be visible on the LAN side. On the Internet side you would use WinSCP. –  ultrasawblade Jul 18 '11 at 0:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.