Back to main index

Samba Server

For more options read the full tutorial here

Install Samba
dnf install samba samba-common samba-client
Setup the share location
mkdir -pv /mnt/sdb1/1TBsamba
chmod -Rv 755 /mnt/sdb1/1TBsamba
chown -Rv nobody:nobody /mnt/sdb1/1TBsamba
chcon -u system_u -t samba_share_t -v /mnt/sdb1/1TBsamba
Backup existing configuration
mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
Edit the file /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = rocky-9
security = user
map to guest = bad user
dns proxy = no
ntlm auth = true


[Public]
path =  /mnt/sdb1/1TBsamba
browsable =yes
writable = yes
guest ok = yes
read only = no
Check if smb.conf is correct with:
testparm
Activate the services
systemctl start smb.service
systemctl start nmb.service

systemctl enable smb.service
systemctl enable nmb.service

systemctl status smb.service
systemctl status nmb.service
Allow samba ports in iptables
# Open Samba ports for everybody from LAN
iptables -A INPUT -s 192.168.0.0/16 -p udp -m udp --dport 137 -j ACCEPT
iptables -A INPUT -s 192.168.0.0/16 -p udp -m udp --dport 138 -j ACCEPT
iptables -A INPUT -s 192.168.0.0/16 -p tcp -m tcp --dport 139 -j ACCEPT
iptables -A INPUT -s 192.168.0.0/16 -p tcp -m tcp --dport 445 -j ACCEPT

i6ptables -A INPUT -s fe80::/10 -p udp -m udp --dport 137 -j ACCEPT
ip6tables -A INPUT -s fe80::/10 -p udp -m udp --dport 138 -j ACCEPT
ip6tables -A INPUT -s fe80::/10 -p tcp -m tcp --dport 139 -j ACCEPT
ip6tables -A INPUT -s fe80::/10 -p tcp -m tcp --dport 445 -j ACCEPT


Access the share on Windows with: \\192.168.178.20
samba windows client


Access the share on Linux with: smb://192.168.178.20
samba linux client


Access the share on Android with:
samba android client


To share a Private folder and protect it with a password, read the second part of the tutorial


Back to main index