Samba – permission denied when share in another users home directory

permissionssamba

I have the two users equah and hoster on my machine.

I created a samba share test1 in /home/equah, which is accessible by user equah without any problem.

I also created the share test2 in /smbtest and changed ownership to user equah, which is accessible by equah too.

But when I create the share test3 in /home/hoster/sharetest and try to connect, nautilus prompts with Failed to mount Windows share: Permission denied, which is what i would like to get working.

ls -l shows the following details on the described directories:

drwx------ 14 equah equah 4096 Sep  8 20:09 /home/equah
drwxr-xr-x 2 equah equah 4096 Sep  8 20:33 /smbtest
drwxrwxrwx 3 equah equah 4096 Sep  8 20:44 /home/hoster/sharetest
drwx------ 19 hoster hoster 4096 Sep  8 20:20 /home/hoster

I also saw, that Access Control System applied permissions on the hoster home directory, which I removed to see if this was the error, but without any success.

I currently use a fresh Arch Linux installation with samba 4.8.5-1.

My samba configuration (/etc/samba/smb.conf) contains:

[global]
   workgroup = EQGROUP
   server string = eq-host samba server
   server role = standalone server
   log file = /var/log/samba/%m.log
   max log size = 50
   dns proxy = no 

[test1]
   comment = test
   path = /home/equah
   valid users = equah

[test2]
   comment = test
   path = /smbtest
   valid users = equah

[test3] # <== Not Working ?
   comment = test
   path = /home/hoster/sharetest
   valid users = equah

My toughs are, that some permission settings might prevent the logged in samba user from accessing content of a directory from which any parent directory is owned by another user. Tough creating a share in /home/hoster/sharetest/test and changing ownership of both sharetest/test to equah, does also not work to share only the test folder

Best Answer

You've got a classic ownership/permissions problem here. You've told SAMBA to allow access to /home/hoster/sharetest only to equah but your underlying filesystem permissions deny access to that user (drwx------ 19 hoster hoster 4096 Sep 8 20:20 /home/hoster).

Allow equah access to the directory and it should be ok

chmod a+x /home/hoster

Or force the access by equah to be performed by hoster

# add to smb.conf share definition
force user = hoster

In general this kind of problem can be diagnosed using log level = 3 and looking in the SAMBA server log files.

Related Question