I’ve been wanting to set up a server in my house for a while now and over the last year I’ve played with various services I could run to make the thing useful.
Back around the turn of the new year I learnt to set up a simple web server using apache (I say simple because I didn’t do anything complex with it, however apache is a very powerful tool if used by someone with some knowledge on the subject). I used this server for sharing photos and series of short home-movies but after a while got bored and turned it off.
I also set up the computer to run an IRC daemon, which was fairly easy, but I had no real reason for using this service and again turned it off (TBH I would have gone further with the IRC but the reason I stopped is because I wanted to put a java applet for accessing the service on a web-page so that people could use it without a dedicated client, but to this day I have failed to find the code and don’t have the competancy to write it myself…).
It’s this sort of thing that I had hoped to use the SPARC box for but I still haven’t got that computer in a working state that I’m happy with, which is a shame.
Well anyway… learning about setting up services is something I’ve been enjoying and I figured it was about time I figured out how to use Samba, which is a protocol used for sharing files with computers running a Microsoft operating system.
My first source of information was the Linux Reality podcast. Chess Griffin made a series of podcasts, each about 30 minutes long, about setting up various services on a home server and they are very comprehensive. After listening to this I also consulted the Archlinux wiki so that I could see where Archlinux places the config files for samba.
Configuring Samba was actually easy. For me it was merely a matter of editing the file /etc/samba/smb.conf thusly (these are excerpts from various points in the file):
#Global Parameters
workgroup = HOME
netbios name = Server
encrypt passwords = yes
This (above) sets the identity for the server as it will be seen on the Windows box(es).
[homes]
public = yes
writable = yes
NOTE: This section allows users read and write access to home folders on the host system so you want to be careful using this setup!!!
The following section is for selecting the folders I wanted to share; they will show up as though they are all in one folder on the Windows machine’s network neighbourhood.
[music]
path = /mnt/files/music/
browseable = yes
read only = yes
valid users = arfab, sambauser <– sambauser will need to be created (later)
I don’t really think it needs further explanation…
Now I’ve got the server set up, in Archlinux it was just a matter of adjusting my security settings appropriately so allow other computers on my network to access the service… This turned out to be the hard part but in a way I’m quite pleased about that because it shows that I have a secure system set up!
Firstly I had to edit the /etc/hosts.deny file because that was locking everyone out.
Next I had to edit the firewall. My firewall program of choice (which is basically just a GUI for iptables) is Firestarter; it is simple and it works well. The ports that needed to be opened were 135, 137, 138 and 445. It’s quite a few ports, but I set it to only allow access from 192.168.1. to keep it internal (in theory).
The final step was to create the user “sambauser” so that there was a username and password for others to log in to the server with. That required the usual
# adduser
and then I had to give them a samba password using:
# smbpasswd -a sambauser
Job done.
Filed under: Uncategorized | Tagged: Archlinux, Linux, Samba, Server