Symlink on usb stick using dolphin : adapt path to the effective logged user

Using dolphin, when a user USER1 create a folder FOLDER1 on an usb stick labelled “SANDISK_64GB_X”, it is found in ‘/run/media/home/USER1/SANDISK_64GB_X/FOLDER1’
if you use the same usb stick on the same computer but as another user USER2, you find your files and folder in ‘/run/media/home/USER2/SANDISK_64GB_X/FOLDER1’ if there is no access restiction.

It seems that it is not the same when using symlinks.
Example :
user USER1 is presently logged.
Using dolphin it creates a folder named version1 and put some files and folders on an usb stick labelled “SANDISK_64GB_X”.
Now another user USER2 using the same usb stick creates a folder named version2 and put some files and folders in it.
Then USER2 create a new folder named CURRENT and make a soft link from folder version2 to folder CURRENT and named the symlink CUR_VER.
So the datas are in ‘/run/media/home/USER2/SANDISK_64GB_X/CURRENT/CUR_VER’
Now USER1 use the usb stick.
Due to current permissions, USER1 can read files and folders in folder version1 and in folder version2 but it cannot read data from CUR_VER
In dolphin the property “point to” of the link is set to “/run/media/home/USER2/SANDISK_64GB_X/CURRENT/CUR_VER”.
So user1 cannot access to “/run/media/home/USER2/SANDISK_64GB_X/CURRENT/CUR_VER” because this path does not exists.

I need to manually replace USER2 by “$(logname)” in the link property.

Is there a way to have symlink behaves like real path ?

Correction :
!
! I need to manually replace USER2 by “$(logname)” in the link property.
!

Yes for accessing by command line, but seems not working using dolphin.

That is a permission issue.

What is the formatting of the drive?
exFAT or FAT should not have issues.

If you have ext3 / btrfs on the drive every file gets the permissions of the owner.

So your user 1 could be user 1000 group 1000
So only that one can access the files and directories.

If your user 2 eg. 1001 : 1001 wants to access a 1000:1000 you would need to set the file permission to 1000,1001: 1001:1001 or you add the user to a group and create all the files under that group.

Not at all.
The link seems to be hard-coded.

As I try explain :

In dolphin the property “point to” of the link is set to “/run/media/home/USER2/SANDISK_64GB_X/CURRENT/CUR_VER”.
So user1 cannot access to “/run/media/home/USER2/SANDISK_64GB_X/CURRENT/CUR_VER” because this path does not exists.
I need to manually replace USER2 by “$(logname)” in the link property.

You compare apples and oranges.

Mount points for removable drives are created dynamically when such drive is detected (when you insert your USB stick). They are created by your desktop software for the user currently logged in on the console.

Symlink has static content that is fixed at the time symlink is created.

You show the name of symlink, not the content of it. The name is not a problem here.

Of course, this path does exist. But the target of this symlink does not.

How many times do we need to repeat - never describe what computer does, show the actual commands and their output. Show

ls -l /run/media/home/USER2/SANDISK_64GB_X/CURRENT/CUR_VER

or (if you are logged in as user1)

ls -l /run/media/home/USER1/SANDISK_64GB_X/CURRENT/CUR_VER

You can manually mount the drive to a place you want.

e.g.

sudo mount /dev/sdX /mnt/

This would make the USB stick available under
/mnt/ if you have multiple drives, you need to add directories. /mnt/1/ …

to remove the stick you need to unmount it manually

sudo umount /dev/sdX

No. If I am logged as USER1 and then mount the usb key, the path to the files and folders is :

/run/media/home/USER1/SANDISK_64GB_X/CURRENT/CUR_VER

I may not found something like

/run/media/home/USER2/SANDISK_64GB_X/CURRENT/CUR_VER

As I can’t log as user2 I can’t find and open the files in ‘/run/media/home/USER2/SANDISK_64GB_X/CURRENT/CUR_VER’

What my question means is :
If the link was coded like this :’ /run/media/home/$(logname)/SANDISK_64GB_X/…’ it gives registered user the possibility to access the link.

And I asked you to show

ls -l /run/media/home/USER1/SANDISK_64GB_X/CURRENT/CUR_VER

With more than one user accessing an USB stick a shared mount point can be appropriate:

erlangen:~ # findmnt --types vfat
TARGET           SOURCE         FSTYPE OPTIONS
/boot/efi        /dev/nvme1n1p1 vfat   rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
/media/UEFI_NTFS /dev/sdc2      vfat   rw,nosuid,nodev,relatime,uid=1000,gid=100,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro
erlangen:~ # 
erlangen:~ # cat /etc/udev/rules.d/99-udisks2.rules 
# UDISKS_FILESYSTEM_SHARED
# ==1: mount filesystem to a shared directory (/media/VolumeName)
# ==0: mount filesystem to a private directory (/run/media/$USER/VolumeName)
# See udisks(8)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"
SUBSYSTEM=="block", ENV{ID_FS_UUID}=="2260f160-cc05-47cc-9893-cc32c050177d", ENV{UDISKS_IGNORE}="1"
SUBSYSTEM=="block", ENV{ID_FS_UUID}=="f5177cae-4082-44ed-9471-b99030f06866", ENV{UDISKS_IGNORE}="1"
erlangen:~ #