May 13, 2014

3. File server

Now we have a webserver, torrent server (which is downloading all your torrents to an attached hard drive), I have set up a file server to serve the torrent folder to my windows computers in the house. This means I can plug my laptop in the TV, browse to the rpi, and play a show :). Here’s how I did so.

First you need to make sure you have samba installed

sudo apt-get install samba

I have made the share a public share with guests allowed ( so its not very secure ), but I like to think my wifi is secure enough to stop people from gaining access. That said, it doesn’t really matter if anyone can view the files, as I have set them to read only, and only people on the LAN can view them.

Once Samba is installed, the next step is to add the shares you want to smb.conf, located in /etc/samba/. Below is a snippet of my smb.conf file, showing the public share of the external hard drive attached to the pi, mounted at /mnt/usb/

[usb]
comment = USB
path = /mnt/usb/Torrents
only guest = Yes
read only = Yes
browseable = Yes
public = Yes

I place this at the bottom of the file, leaving everything else as default. Just to make sure that everything is okay, I recommend running the tool testparm. This will check your samba config file to make sure there are no errors.

testparm

if you get no errors, go ahead and start your server

sudo service samba start

Now that samba is running, you can map that drive from any other device on your LAN. e.g from my windows pc, just map new network drive and put in the path \\<ip of rpi>\usb and I can view all my downloads!