Ever had Samba shares on CentOS become randomly inaccessible? If so, I might have a cure… Turns out the culprit is (yet) again SELinux. Thank you SELinux for your super sensitive security policies…
It turns out that you might have lost extra important SELinux label on the share and sub-folders. Don’t ask me why and how? Perhaps a boot failure or power failure or random act of God?!
OK, here’s the solution you are looking for. Logon to your CentOS server and simply issue the chcon command. Be sure to do it recursively if you want to access sub-folders inside.
chcon -R -t samba_share /mnt/storage1
and that’s it! This will once again make that share accessible. Really… that simple!
EDIT: I figured out why lockouts were happening. It turns a Docker container was accessing these shares and resetting the label. If I set the label back to samba_share_t and make Docker container stop resetting it, then Docker container loses access to the folders. argh!