Samba public share – access denied

fedorasamba

I'm trying to configure Samba for sharing public folders – without necessity to log in. I'm using Fedora 16.

$ smbd --version
Version 3.6.1-74.fc16

Config:

[global]
   workgroup = WORKGROUP
   security = share
   hosts allow =  192.168.
   load printers = yes
   guest account = nobody
   log file = /var/log/samba/log.%m
   max log size = 50
   domain master = no
   local master = yes
   os level = 35
   null passwords = true
   username map = /etc/samba/smbusers
   name resolve order = hosts wins bcast
   dns proxy = no

[test]
   comment = Pliki Estomedu
   path = /tmp/test/share
   public = yes
   writable = yes
   browseable = yes
   force user = nobody
   force group = nogroup
   create mask = 0777
   directory mask = 0777
   available = yes

Path:

ls -la /tmp/test/share/
total 8
drwxr-xr-x. 2 root root 4096 Nov 14 13:09 .
drwxrwxrwx. 3 root root 4096 Nov 14 13:09 ..

smbusers:

# Unix_name = SMB_name1 SMB_name2 ...
root = admin
nobody = guest pcguest smbguest

What I get when I try to connect (providing empty password):

$ smbclient \\\\localhost\\test
WARNING: The security=share option is deprecated
Enter root's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.1-74.fc16]
Server not using user level security and no password supplied.
smb: \> ls
NT_STATUS_ACCESS_DENIED listing \*

Please help. The share is visible from WinXP and Win7 but get access denied message as well.

Best Answer

I found an alert:

SELinux is preventing /usr/sbin/smbd from read access on the directory share.

The best solution is to allow sharing only chosen directories:

/usr/sbin/semanage fcontext -a -t samba_share_t <path>

You can also allow SAMBA to share all directories:

setsebool -P samba_export_all_ro 1