How to setup Samba on Fedora 28 as a public share
- 
 I had to do this recently and, as usual, I though you all might want to have a guide. Start with Fedora 28 Minimal and then make sure it is up to datesudo dnf upgrade -y --refreshNow install everything you will need.Note: I am installing cockpit in order to use it to setup the storage, because I don't fstabunless I have to. Same fornano, becausevi.sudo dnf install cockpit cockpit-storaged nano samba policycoreutils-python-utils -yOpen the firewall for use of cockpit and sambasudo firewall-cmd --add-service=cockpit --permanent sudo firewall-cmd --add-service=samba --permanent sudo firewall-cmd --reloadSet cockpit set to start on reboot, and start nowsudo systemctl enable --now cockpit.socketCreate the mount pointThis examples uses /datafrom here on.sudo mkdir /dataSetup your storageLog into cockpit and setup your storage disks or setup your storage disks manually in /etc/fstab. Then reboot to make sure it all comes back right on rebootsudo rebootTell SELinux that this is a samba sharesudo semanage fcontext -a -t samba_share_t "/data(/.*)?" sudo restorecon -Rv /data/Create the folders to be shared, only public in this examplesudo mkdir -p /data/shares/publicMake a copy of the original smb.confsudo cp /etc/samba/smb.conf /etc/samba/smb.conf.origEdit the smb.conf as neededsudo nano /etc/samba/smb.confFor this example, I have this in the smb.conffile.[global] workgroup = WORKGROUP security = user map to guest = bad user min protocol = SMB2 passdb backend = tdbsam [Public] comment = Public Read / Write path = /data/shares/public public = yes browseable = yes writeable = yes read only = no force user = pubshare guest ok = yes guest only = yesCreate the user, in Fedora, that samba will use for the foldersudo useradd pubshare -s /usr/sbin/nologinCreate the user in sambaNote: Just hit enter twice to set a blank password, or set a real password. It will not affect the operation of the share. sudo smbpasswd -a pubshareChange the owner of the share to the user just createdsudo chown pubshare /data/shares/public/Restart Samba and connect to your share from another system.sudo systemctl restart smb
- 
 I am intentionally not dealing with password protected share because that gets into a lot of choices. Such as local privileges, or tie to AD, or tie to some other auth, etc. 
- 
 Thanks a lot! 
- 
 Nice write up, thanks! 


