sudo apt install samba
or sudo dnf install samba
, then sudo vim /etc/samba/smb.conf
, and specify something like this:
# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.
#
# Note:
# SMB1 is disabled by default. This means clients without support for SMB2 or
# SMB3 are no longer able to connect to smbd (by default).
[global]
workgroup = WORKGROUP
security = user
passdb backend = tdbsam
log file = /var/log/samba/%m.log
log level = 3
# samba doesnt use system passwords, but uses system users, so
# for a user we need to create "samba password" using
# sudo smbpasswd -a username
[testshare]
path = /home/john/testshare
read only = no
browsable = yes
force user = john
writeable = yes
public = yes
valid users = john
#directory mask = 2775
#create mask = 0664
#force create mode = 0664
#force directory mode = 2775
comment = test
then sudo smbpasswrd -a myusername
, specify some password.
Finally, add samba to firewall exceptions. For example, on Fedora,
sudo firewall-cmd --permanent --add-service=samba
sudo firewall-cmd --reload
or
sudo ufw allow samba
and
sudo service smb restart
if on Fedora, when sharing a directory from home folder, we must allow this action, so SELinux doesn't block requests from samba:
setsebool -P samba_enable_home_dirs on
← Back to Articles