Edit: IT WAS F#$CKING SELINUX. echo 0 >/selinux/enforce
and it works.
Edit: Based on the fact I can't view files in the directory even when they are recursively set to ugo+rwx (see edits at bottom of this post), I suspect the problem is more fundamental than the mounted share.
I have the following share setup in my samba configuration:
[test]
path = /mnt/
guest ok = yes
writeable = yes
browseable = yes
The /mnt folder has permissions as follows:
[root@[host-redacted] mnt]# ls -al /mnt
total 16
drwxr-xr-x. 4 root root 4096 Mar 3 00:54 .
dr-xr-xr-x. 25 root root 4096 Feb 25 19:04 ..
drwxr-xr-x. 2 root root 4096 Feb 26 21:45 files
drwxr-xr-x. 2 root root 4096 Mar 3 00:54 tmp
At this point, nothing is mounted to these folders. When I try to access this via samba it works fine:
[root@[host-redacted] mnt]# smbclient -Uguest //[host-redacted]/test
Enter guest's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]
smb: \> ls
. D 0 Sun Mar 3 00:54:52 2013
.. DR 0 Mon Feb 25 19:04:02 2013
tmp D 0 Sun Mar 3 00:54:52 2013
files D 0 Tue Feb 26 21:45:55 2013
50396 blocks of size 1048576. 46487 blocks available
smb: \> cd files
smb: \files\> ls
. D 0 Tue Feb 26 21:45:55 2013
.. D 0 Sun Mar 3 00:54:52 2013
50396 blocks of size 1048576. 46487 blocks available
However after I mount an encrypted share to that drive things to awry. I mount it and check permissions and ownership are identical:
[root@[host-redacted] mnt]# mount /dev/mapper/[encrypted-partition-redacted] files
[root@[host-redacted] mnt]# ls -al /mnt/
total 16
drwxr-xr-x. 4 root root 4096 Mar 3 00:54 .
dr-xr-xr-x. 25 root root 4096 Feb 25 19:04 ..
drwxr-xr-x. 13 root root 4096 Jul 6 2012 files
drwxr-xr-x. 2 root root 4096 Mar 3 00:54 tmp
But now when I access the share, the files directory has disappeared:
[root@[host-redacted] ~]# smbclient -Uguest //[host-redacted]/test
Enter guest's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]
smb: \> ls
. D 0 Sun Mar 3 00:54:52 2013
.. DR 0 Mon Feb 25 19:04:02 2013
tmp D 0 Sun Mar 3 00:54:52 2013
50396 blocks of size 1048576. 46487 blocks available
I did a quick check to make sure my guest user (nobody) can read /mnt and it seems okay:
[root@[host-redacted] mnt]# sudo -u nobody ls /mnt
files tmp
Can someone explain what is going on? My samba configuration was copied from a previous machine running samba 3.3 in much the same setup, and this new setup is running the same configuration (files copied) but with samba 3.5.10-125.el6
.
I've also checked the changelog and can't see anything that stands out.
edit: I do not have any veto files directive in my smb.conf:
[root@pmfs mnt]# grep -i veto /etc/samba/smb.conf
edit2: When the directory is not mounted I am able to cd into files - HOWEVER I am not able to see a file I created there
[root@pmfs samba]# echo asdf > /mnt/files/test.txt
[root@pmfs files]# chmod -R ugo+rwx /mnt/files/
[root@pmfs ~]# smbclient -Uguest //pmfs/test
Enter guest's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]
smb: \> ls
. D 0 Sun Mar 3 00:54:52 2013
.. DR 0 Mon Feb 25 19:04:02 2013
tmp D 0 Sun Mar 3 00:54:52 2013
files D 0 Mon Mar 4 20:05:45 2013
50396 blocks of size 1048576. 46486 blocks available
smb: \> cd files
smb: \files\> ls
. D 0 Mon Mar 4 20:05:45 2013
.. D 0 Sun Mar 3 00:54:52 2013
50396 blocks of size 1048576. 46486 blocks available
As well as a solution to this specific problem I'd be interested in knowing if there is anything else I should be doing to troubleshoot this problem - as I have often struggled with configuring samba I'm always interested in learning how to better improve the troubleshooting process
Rather than just disabling SELinux for everything (echo 0 >/selinux/enforce) just configure SElinux to allow samba access
which will give samba access. You can then use
to ensure that a subsequent restorecon doesn't unfix this.