Here is a sample config that works very well with me:
# Reference doc:
# https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html
[global]
# Parameters in this section apply to the server as a whole, or are defaults for sections that do not specifically define certain items.
smb encrypt = required
disable netbios = yes
server string = My Fav FileServer
mangled names = no
workgroup = WORKGROUP
netbios name = FILESERVER
max protocol = SMB3
os level = 20
security = user
passdb backend = tdbsam
restrict anonymous = 2
admin users = root,makina
encrypt passwords = true
obey pam restrictions = yes
pam password change = 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* .
add user script = /usr/sbin/useradd -m '%u' -g users -G users
delete user script = /usr/sbin/userdel -r '%u'
add group script = /usr/sbin/groupadd '%g'
delete group script = /usr/sbin/groupdel '%g'
add user to group script = /usr/sbin/usermod -G '%g' '%u'
guest account = nobody
syslog = 0
log file = /var/log/samba/samba.log
max log size = 1000
log level = 2
wins support = yes
dns proxy = no
socket options = TCP_NODELAY
panic action = /usr/share/samba/panic-action %d
vfs object = recycle
recycle:touch = yes
recycle:keeptree = yes
recycle:versions = yes
recycle:exclude_dir = tmp quarantine
[makina]
create mode = 0664
directory mode = 3775
force user = makina
wide links = no
valid users = makina,electric
comment = Makina share
writeable = yes
browseable = no
path = /mnt/makina
Of course, your requirements could be different, so maybe first try with this sample, ensure that it works, and then adjust little by little to your needs while testing each change..
However, I suspect it’s actually an NFtables firewall issue underneath it all; the firewall doesn’t let me add the Samba service (which doesn’t appear in the bootup-shutdown module), so NFtables gives me a ‘service not found’ error.
On a separate note, I would love to see Webmin create a ufw module
If I shutdown the firewall it connects and works as expected. Further investigation is therefore required
Thankyou, you helped me out with the conf file you shared.
My actual issue is now resolved. I can connect to the shares as the user, and it ‘drops’ me into that user’s home directory, which is exactly what I wanted. I’ll mark this as a solution.
You can use the webmin module for nftables to create these rules (in your input chain).
Start by creating a ‘Set’ for each protocol’s ports. That is, create a set ‘smb_udp’, type ‘inet_service’, containing 137,138; and a similar set ‘smb_tcp’ for the TCP ports 139, 445.
Next, create a rule in your ‘input’ chain with ‘accept’ action, your subnet (e.g. 192.168.1.0/24) in source address, protocol udp, and under destination port, use set, and choose smb_udp. Repeat for the tcp set.
Not all of these ports will be necessary if, for example, netbios is disabled in your environment. In which case, you should be okay just opening TCP port 445. So, instead of creating the 2 sets above create a single TCP set containing port 445.