Intro
Edit October 2020
The original post dealt with setting up a share from an Ubuntu server to provide read/write access without a password. Since writing that part I purchased a Synology NAS and am now including sections on setting up shares for that.
Most SAMBA guides I find online are some combination of out of date or focused on the enterprise. My objective is to provide a quick reference for setting up files shares from a Linux server to Windows clients, or to properly mount SAMBA shares from a NAS device onto Linux clients. This is only appropriate for a home network. In the case of the Linux server I’m sacrificing security/specific user permissions for being easily able to connect to my file share. On a small LAN where I can easily physically monitor the devices I think this is worth it. Clearly you should not do this for an organization or if you have more sensitive data you’re sharing.
Password free server on a Linux box
What I’m installing this on
The current server I’m running this on is an Ubuntu 18.04 machine. Hopefully most of this will translate to similar setups. I’m sure I’ll be upgrading the OS soon so I’ll edit this if I encounter any breaking changes.
The steps
Install samba
sudo apt install samba
Backup any existing smb.conf and then update
# If you have one already
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
Now setup the new smb.conf
:
[global]
map to guest = Bad User
logging = systemd
log level = 1
guest account = <username>
[data]
# This share allows guest read write access
# without authentication, hope you trust everyone on your LAN
path = /mnt/data/ # Or whatever folder you're sharing
read only = no
guest ok = yes
guest only = yes
Where <username> is the user on your samba server that has appropriate access to the folder you’re sharing.
After saving the config file you can run testparm
to see if there are any syntax errors.
Restart and enable SAMBA, give it a test
From the samba server:
sudo systemctl status smbd # check if it's running
# If it's running do this
sudo systemctl restart smbd
# If it's not do this
sudo systemctl start smbd
Try and connect from a Windows machine, make sure you can create and delete files. Back on the samba client you can check if the files you created have the right permissions (should be assigned to the user you created).
Assuming everything works enable the server so it will reload if you restart the machine. From the samba server:
sudo systemclt enable smbd
No Password Conclusion
That’s it! Super simple but every time I tried to get a SAMBA share going in the past I always ended up struggling. Hopefully this guide will be helpful to future me and anyone else who’s got a similar situation.