February 17, 2017

Fedora 25 -- Samba

I just finished a fresh, from scratch install of Fedora 25. I would like to get my samba server running again (it holds all of my photos and is accessed by my Windows machine that runs Lightroom).

Ports

If you are running a firewall, you need to open up several ports for Samba. I just copy my old /etc/sysconfig/iptables file and I am good to go. If you are starting from scratch, the ports you need to open are:

Install packages and fuss with config files

There is something called smb4k, but all evidence indicates that it is not what I want and am ignoring it. It is some kind of file gadget with smb capability for KDE (hence the clever "4K" in the name). Not the droids we are looking for.

dnf install samba
vi /etc/samba/smb.cnf
After editing the smb.cnf file (I just copied a working file from my previous install), you can check it for validity using the command:
testparm
The next thing to think about before starting the server is your samba users. If you don't have any, you make them using something like:
smbpasswd -a fred
In my case, I want to just migrate my users and passwords from the files I backed up from my old install. I have long since forgotten the password I set and it is hidden away in my windows setup. The last thing I want to do is to set a new password and go through the fight with windows once again.

Looking at my old install, I see the directory /var/lib/samba/private and in it I see two files:

-rw-------. 1 root root 421888 Feb 17 20:18 passdb.tdb
-rw-------. 1 root root 430080 Feb 17 20:18 secrets.tdb
I copy these to the new install and cross my fingers.

Finally to get the service going, do this:

systemctl enable smb.service
systemctl restart smb.service
This blows up and looking at /var/log/messages, I see (among other things):
SELinux is preventing smbd from open access on the file /etc/samba/smb.conf
This reminds me of what I consider an essential part of every linux install, namely disabling selinux. No doubt there is some way to get selinux to play nice with samba, but I am not interested. I'll go back and add this to my F25 post install customization checklist. After nuking selinux, this starts up samba just fine, my windows machine can access the shares just like always. So I guess copying those files in the "private" directory did the trick.


Have any comments? Questions? Drop me a line!

Adventures in Computing / [email protected]