• Hardware: Raspberry Pi 2
  • OS: Arch Linux ARM

Sometimes you just need a quick file server to move some data around. On a private network an unauthenticated Samba share on a Raspberry Pi works great, but do this only at home! Here’s what I did to get mine set up.


My trusty Raspberry Pi 2 had been shelved for a few months; naturally, I started with a full system update.

# pacman -Syu

No problems with the belated update despite Arch being a rolling-release distro. I’ve been told that can be a problem but I’ve always had good luck. Now, let’s install samba.

# pacman -S samba

The package will place a default configuration file at /etc/samba/smb.conf.default – you can copy this directly to /etc/samba/smb.conf, or do what I prefer and copy it to smb.conf.master, make the needed changes in that file, and then output a clean, verified config file using the testparm utility included in the samba package:

# testparm -s smb.conf.master > smb.conf

Regardless of how you do it, this is the final smb.conf file that I used:

    server string = pi
    workgroup = WORKGROUP
    log file = /var/log/samba/%m.log
    max log size = 50
    map to guest = Bad User
    security = USER
    dns proxy = No
    idmap config * : backend = tdb
    hosts allow = 192.168.1. 127.

    comment = All Printers
    path = /var/spool/samba
    browseable = No
    printable = Yes

    comment = Put Stuff Here
    path = /srv/share
    guest ok = Yes
    guest only = Yes
    read only = No

Most of that is from the default smb.conf, but there are a few noteworthy lines there:

  • map to guest = Bad User – This will map all unauthorized credentials to the guest user, which is needed for public access to the share.
  • hosts allow = 192.168.1. 127. – This will limit access to hosts on your private network (in my case,
  • The [share] block – You’ll need to add this block to your config, adjusting as needed for your setup. The options listed direct the share to my local path and make it writable by and restricted to guest users.

I created a directory at /srv/share, owned by root:root and set to 777 permissions. As I said, this is just for home use! By default, files created inside the directory by guest users will be owned by nobody:nobody with 744 permissions, all of which works fine for my needs.


Iptables was already configured on the Pi, so I just needed to add rules for Samba’s ports:

# iptables -A TCP -p tcp -m tcp --dport 137 -j ACCEPT
# iptables -A TCP -p tcp -m tcp --dport 138 -j ACCEPT
# iptables -A TCP -p tcp -m tcp --dport 139 -j ACCEPT
# iptables -A TCP -p tcp -m tcp --dport 445 -j ACCEPT

Then, update the config file and restart the iptables service:

# iptables-save > /etc/iptables/iptables.rules
# systemctl restart iptables

Finishing Up

With all that configured, all that’s left is to enable and start the samba service:

# systemctl enable smbd
# systemctl start smbd

At this point I was able to connect and write to the share from my Mac at smb://pi/share, and from my Windows machine at //pi/share. Works great!