-3

So, I tried to set up a public SMB share with Samba on CentOS 7. Now, I have it set up, and I have a headache. But, sweet victory. I'm posting this here for all y'all so that you don't need to waste your time. It's actually easy, you just need to know the hoops you need to jump through. I'll also edit the Samba wiki.

The first problem was that it wouldn't connect at all, except locally:

Remote Connection (my Linux desktop):
-------
[root@my-desktop ~]# smbclient //sambaserver/PublicDocs -N
Error connecting to 192.168.100.97 (No route to host)
Connection to cgybkp01 failed (Error NT_STATUS_HOST_UNREACHABLE)

On Windows 8, using Windows Explorer, after typing "\\sambaserver" into the address bar, the progress bar would wait, wait, wait, then time out. The error message was:

Remote Connection (my Windows 8 desktop):
Windows cannot access \\sambaserver
Check the spelling of the name. Otherwise, there might be a problem with your network. To 
try to identify and resolve network problems, click Diagnose.

This ended up being a problem with firewalld. To unblock Samba, I needed to add this line to /etc/firewalld/zones/public.xml :

<service name="samba"/>

Perfect, now I can connect!


But, I was actually mounting an NFS share, so I had one more issue, with SELinux. Now, when I attempt to connect with smbclient...

smbclient //sambaserver/PublicDocs -N

I can connect, but when I try to ls, I get the error: "NT_STATUS_ACCESS_DENIED" in CentOS 7. So, how do I connect?

turiyag
  • 2,757
  • 2
  • 22
  • 21

1 Answers1

0

The first thing everyone recommended that I try was file permissions. If you're not familiar with file permissions in Linux, I'd recommend trying those first. But for me, that didn't work, because SELinux was blocking me.

To see all of the SELinux options for Samba, type:

getsebool -a | grep samba
getsebool -a | grep smb

The one I needed to change was samba_share_nfs, because I was sharing an NFS mounted directory:

setsebool -P samba_share_nfs on

CentOS maintains a list of these booleans here.

turiyag
  • 2,757
  • 2
  • 22
  • 21