https://www.howtoforge.com/tutorial/samba-server-ubuntu-16-04/
apt-get install -y samba samba-common python-glade2
cp -pf /etc/samba/smb.conf /etc/samba/smb.conf.bak
cat /dev/null > /etc/samba/smb.conf
vim /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = ubuntu
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions=====
[Anonymous]
path = /samba/anonymous
browsable =yes
writable = yes
guest ok = yes
read only = no
force user = nobody
mkdir -p /samba/anonymous
# create a directory for the anonymous share.
chmod -R 0775 /samba/anonymous
chown -R nobody:nogroup /samba/anonymous
# Set the correct permissions.
service smbd restart
# restart Samba to apply the new configuration.
ls -la /samba/anonymous/
# cross check the content at server.
Secured Samba server:
addgroup smbgrp
useradd till -G smbgrp
smbpasswd -a till
root@server1:~# smbpasswd -a till
New SMB password:<--howtoforge
Retype new SMB password:<--howtoforge
Added user till.
root@server1:~#
mkdir -p /samba/secured
cd /samba
chmod -R 0770 secured
chown root:smbgrp secured
vim /etc/samba/smb.conf
[...]
[secured]
path = /samba/secured
valid users = @smbgrp
guest ok = no
writable = yes
browsable = yes
service smbd restart
testparm
# cross-check the settings