Symlink in samba share keeps asking for credentials

It’s my first time setting up samba. I have a read-only public folder with a symlink to another folder in the same partition. Access to the public folder works, and technically to the symlinked folder also works, except it seems unable to list the folder contents, and when browsed from file explorers it falls into an authentication dialog loop.

I tested it from another OpenSUSE machine and from an Android file explorer with smb implementation. Access to other directories and files in the shared folder works fine. The symlink itself works when accessed directly in the machine being shared.

Both the shared folder and the linked have the same owners, test:root, drwxrwxrwx permissions. I’ve also set a samba password for the test user.

testparm -s

Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed by GnuTLS (e.g. NTLM as a compatibility fallback)

Server role: ROLE_STANDALONE

# Global parameters
[global]
        allow insecure wide links = Yes
        logon drive = P:
        logon home = \\%L\%U\.9xprofile
        logon path = \\%L\profiles\.msprofile
        map to guest = Bad User
        printcap name = cups
        smb1 unix extensions = No
        usershare allow guests = Yes
        usershare max shares = 100
        idmap config * : backend = tdb
        cups options = raw

[Public]
        create mask = 0700
        directory mask = 0700
        guest ok = Yes
        path = /run/media/test/Public
        wide links = Yes

smb.conf

[global]
	workgroup = WORKGROUP
	passdb backend = tdbsam
	printing = cups
	printcap name = cups
	printcap cache time = 750
	cups options = raw
	map to guest = Bad User
	logon path = \\%L\profiles\.msprofile
	logon home = \\%L\%U\.9xprofile
	logon drive = P:
	usershare path = /var/lib/samba/usershares
	usershare max shares = 100
	usershare allow guests = Yes
	usershare owner only = Yes
	allow insecure wide links = yes
	# try everything!
	unix extensions = no
	log level = 2
[Public]
	path = /run/media/test/Public
	browseable = yes
	create mask = 0700
	directory mask = 0700
	guest ok = Yes
	public = yes
	follow symlinks = yes
	wide links = yes

I’ve added samba to the firewall when setting it up, and even disabled the firewall altogether for testing. It doesn’t seem to the the issue.

firewall-cmd --zone=public --add-service=samba
firewall-cmd --zone=public --add-service=samba-client
firewall-cmd --runtime-to-permanent
firewall-cmd --reload

The path to the linked folder is /run/media/test/Public/A

Accessing from smbclient:

> smbclient //10.1.221.50/Public -U test testpss
smb: \> cd A
smb: \A\> ls
NT_STATUS_ACCESS_DENIED listing \A\*

The smb logs shows the auth succeeded:

check_ntml_password: authentication for user [test] → [test] → [test] succeeded

Samba version is 4.22.3-git.403.4e078bdb832SUSE-oS16.9-x86_64

I’m guessing it’s a permission issue. How do I solve this?

You could start with showing the actual permissions of A.

A, the link, is lrwxrwxrwx
The permissions of the source directory for this link is drwxrwxrwx

Okay, a quick and dirty workaround to get a similar functionality is to mount the source folder into the shared folder, example:

mkdir /run/media/test/Public/Mount
sudo mount --bind ' /run/media/test/Source' '/run/media/test/Public/Mount'

It allows the directory to be read without issues, also skipping the auth dialog altogether, which isn’t an issue in this case since I want it /Public to be public within the network. It’s a bit annoying to mess with fstab for directories that will come and go though.

There’s an extra datapoint I actually didn’t share: Everything is in a ntfs partition.

The user being used to access the samba share etc owns everything down to the mount point of the partition, and the permissions after mounting look nearly identical to the symlink attempts except for not being a link, but the fs might be related anyway.

Permissions:

# Samba share
/run/media/test/Public
drwxrwxrwx

# Mounted folder
/run/media/test/Public/Mount
drwxrwxrwx

# Symlink
/run/media/test/Public/Link
lrwxrwxrwx

# Source folder for mount and link
/run/media/test/Source
drwxrwxrwx

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.