Stop deadnaming me, Samba!
Oct 18, 2019A brief follow-up to Stop deadnaming me, Linux!
One thing I do is run a Linux VM on my MacOS laptop. I generally want these to be isolated, but to have a single folder available to share between them. To do this I previously created a samba share in the VM which I mount as necessary in MacOS. Changing my username broke this, but it was easy to fix. The VM I’m using is running Fedora 30, samba is from the fedora repository; if you’re on a different distribution or using a different package you may have a slightly different experience – these are really just notes-to-self, but I hope you’re able to benefit from them if you stumbled upon this.
Fix samba users
- Create a new samba user. As root, run
smbpasswd -a [name]
to create a new samba user for your username. This should match your system username, but when prompted to set a password you can use any password you like. - Banish your deadname samba user. As root, run
smbpasswd -x [deadname]
. You should see a response like this:
Failed to find a Unix account for deadname Deleted user deadname
Update the samba share configuration
Edit your samba share configuration; for me, this was located in /etc/samba/smb.conf
:
[shared]
comment = Shared with Host
browsable=yes
path=/home/deadname/Shared
public=no
valid users=deadname
write list=deadname
writeable=yes
create mask=0770
Force create mode=0770
force group=deadname
Using your favorite text editor or sed1, replace deadname
with name
and restart samba (systemctl restart smb
as root).
You’re done!
- Sed oneliner:
sed -i 's/deadname/name/' /etc/samba/smb.conf
– if you’re not using GNU sed, you’ll need to specify an extension after-i
for creation of a backup file when performing inline edits. [return]