Hi Frede,
I think it would be of help if I share a couple of quick tips as a follow-up of Samba: no r/w access to shared files and other problems I had with Samba recently. Feel free to add them to your root tip, if you like.
First, my problem with r/w access to my own share was caused by ACL. In essence, it was similar to this issue. Plain dumb solution is to remove your share and create it again. And no need to change tdbsam
to smbpasswd
, you were absolutely right.
Next, another weird (at first glance) problem a user could face recently is inability to even view server’s shares at all with a not-so-easy-to-understand error message (“broken pipe” or something). Oh, my hair got grey while trying to figure the cause of this issue. It was simple though, and the culprit was AppArmor update. Some users might have it enabled as well, and chances are they might face a similar problem too, so what a person need to do it such situation is sudo aa-complain /etc/apparmor.d/usr.sbin.smbd
for a quick fix and proceed to reading documentation on editing AppArmor profiles for a better and more long-term solution.
And the last but not least let me comment on your warning " Never run a samba file server on a laptop (it’s portable and smb service is easy to forget)"
I’m not sure if my suggestion is good from a Linux admin’s perspective, but I think for a casual home user it would suffice: create a Network Manager dispatcher script that will run or stop smb.service when your laptop connects and disconnects to/from your home networks, e.g.:
/etc/NetworkManager/dispatcher.d/20-smb_server.sh
#!/bin/bash
# Find the connection UUID with "nmcli con show" in terminal.
# All NetworkManager connection types are supported: wireless, VPN, wired...
if [[ "$CONNECTION_UUID" == "%UUID_1%" ]] || [[ "$CONNECTION_UUID" == "%UUID_2%" ]] || [[ "$CONNECTION_UUID" == "%UUID_3%" ]]; then
# Script parameter $1: NetworkManager connection name, not used
# Script parameter $2: dispatched event
case "$2" in
"up")
systemctl start smb.service
;;
"down");&
"pre-down");&
"vpn-pre-down")
systemctl stop smb.service
;;
esac
fi
Write your connection UUIDs (nmcli con show
) and make this file executable, of course.