How To Make A Samba Server KISS-Style
For me personally Samba has been the easiest hassle-free way of sharing files over the network. It worked without any kind of complicated setup and allows me to share perfectly-legal movies, music, and even allows me to sync game files and such with ease. Other sites tend to have a rather overcomplicated config setup and generally make things more confusing than they have to. Hopefully this makes it easier. Note I’m not going to go over mounting anything or setting anything other than PAM authentication.
Installing
For this I’m going to assume you’re gonna be using Ubuntu/Ubuntu server, but the installation process should be pretty straightforward either way.
sudo apt install samba
Bam. Its installed.
Configuring
For this I’m going to use a variant of the default Ubuntu config or
one that I found online somewhere and modified. Either way its pretty
simple and there aren’t a ton of super important things to address.
Since I was trying to link multiple hard drives/partitions under a
single share I ended up having to put
allow insecure wide links
in to let symlinks work. If you
don’t need it then you should be able to remove it.
In /etc/samba/smb.conf
put:
[global]
workgroup = WORKGROUP
allow insecure wide links = yes
server string = %h server
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
[NAMEHERE]
comment = Stuff
path = /PATH/HERE
guest ok = yes
browseable = yes
follow symlinks = yes
wide links = yes
The only things that you need to change are NAMEHERE
and
/PATH/HERE
. Make sure that the path you are setting up
already exists and that the user you want to access it with is able to
modify it.
Running Samba
Once its configured you need to run two commands to get the service started. On Ubuntu it will automatically set up a systemd service so:
systemctl enable smbd
and
systemctl start smbd
After that it should show up in file-system discovery with Linux systems.
Logging In
This will not be completely accessible without setting up a samba
password which is DIFFERENT from your normal password. To set the
password for your user simply run smbpasswd
and you should
be golden.