Simple guide for setting up your Samba file server. Saving and protecting your data is a habit worth having. Before we continue, please make sure you have a static IP configured on your server.
Lets start with updating your system and installing the Samba package.
sudo apt-get update;
sudo apt-get install samba -y;
sudo systemctl stop smbd.service
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
sudo nano /etc/samba/smb.conf
[global]
server string = %h file server
server role = standalone server
workgroup = WORKGROUP
bind interfaces only = yes
disable netbios = yes
smb ports = 445
log file = /var/log/samba/smb.log
max log size = 10000
server signing = mandatory
server min protocol = SMB3
server smb encryption = mandatory
security = user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
client plaintext auth = no
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
load printers = no
printcap name = /dev/null
disable spoolss = yes
The base configuration is complete, now we can move onto creating a user and a shared folder.
sudo mkdir /samba/"
sudo chown :sambashare /samba/
sudo mkdir /samba/bobbybills
sudo adduser --home /samba/bobbybillshome --no-create-home --shell /usr/sbin/nologin --ingroup sambashare bobbybills
sudo chown bobbybills:sambashare /samba/bobbybillshome/
sudo chmod 2770 /samba/bobbybillshome
sudo smbpasswd -a bobbybills;
sudo smbpasswd -e bobbybills;
sudo nano /etc/samba/smb.conf
[bobbybills]
path = /samba/bobbybillshome
browseable = no
read only = no
force create mode = 0660
force directory mode = 2770
valid users = bobbybills
sudo systemctl start smbd.service
sudo reboot
\\your_samba_server_ip_address\bobbybillshome