Dolphin does not understand '$USER' in the path of a link

Hello
Given an usb disk.
All users with an account have access to the computer and can mount the usb disk.
Suppose all folders, files, link created by ‘userA’

Now ‘USERB’ connects and mount the usb disk.
‘USERB’ create a new link named link1 using dolphin.
‘USERB’ make change in a script accordingly with the name of the new link named link1.

The problem is that the script does not run correctly with ‘USERA’ because the link is not found.
The path of the link is hard coded with the name of the logged user.
Changing the name in the file property with $USER, or $(logname) does not help.

How to do this.

How to do what exactly?

If you want to have variable as part of symbolic link target - it is not possible.

Thank you for helping.

The variable part his the name of the user.
usb disk is mounted in /run/media/$USER and that is the variable part of the path.

Given an usb disk named ‘TEST’
Given a user ‘USERX’
It is mounted as : /run/media/USERX/TEST
There is some scripts or data in different folders.
Take one example for a script named ‘SCRIPT1’
This script is founded in folder FOLDER_1 like :

...
.../FOLDER_1/date_1/SCRIPT1.sh
.../FOLDER_1/date_2/SCRIPT1.sh
.../FOLDER_1/date_3/SCRIPT1.sh
.../FOLDER_1/date_4/SCRIPT1.sh
.../FOLDER_1/date_5/SCRIPT1.sh
.../FOLDER_1/date_6/SCRIPT1.sh
.../FOLDER_1/CURRENT_VERSION/script1.sh

where script1.sh is a link to .../FOLDER_1/date_6/SCRIPT1.sh

What I need is that any user running the main script has access to any link created/modified by any users.

Use relative links.

ln -s ../date_6/SCRIPT1.sh script1.sh

You mean that cannot be done directly within dolphin ?

I have no idea about dolphin.

When one use dolphin you get only full path.
If one edit the path in the property and write a relative path like ‘…/…/some_path’, it is rewrite with a full path.

No other way than using command line ?

It must be ../ not .../
It works to me. Would you mind adding some screenshots and explaining better the issue?

As I had nothing better to do :slight_smile: , I briefly tried on Tumbleweed and I most certainly can create relative symlink in Dolphin. So, I agree - some more details what OP tries to do would be useful.

Yes but, if a “normal” user mounts a USB disk by means of a KDE Plasma session, the mount is performed by means of FUSE.

Jul 22 12:12:37 kernel: usb 1-7.2: new high-speed USB device number 6 using xhci_hcd
Jul 22 12:12:38 kernel: usb 1-7.2: New USB device found, idVendor=0718, idProduct=0628, bcdDevice= 1.00
Jul 22 12:12:38 kernel: usb 1-7.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jul 22 12:12:38 kernel: usb 1-7.2: Product: Trans-It Drive
Jul 22 12:12:38 kernel: usb 1-7.2: Manufacturer: TDKMedia
Jul 22 12:12:38 kernel: usb 1-7.2: SerialNumber: 079B0D03BE2413E9
Jul 22 12:12:38 kernel: usb-storage 1-7.2:1.0: USB Mass Storage device detected
Jul 22 12:12:38 kernel: scsi host6: usb-storage 1-7.2:1.0
Jul 22 12:12:38 kernel: usbcore: registered new interface driver usb-storage
Jul 22 12:12:38 kernel: usbcore: registered new interface driver uas
Jul 22 12:12:38 mtp-probe[23062]: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:01.2/0000:01:00.0/usb1/1-7>
Jul 22 12:12:38 mtp-probe[23062]: bus: 1, device: 6 was not an MTP device
Jul 22 12:12:38 mtp-probe[23082]: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:01.2/0000:01:00.0/usb1/1-7>
Jul 22 12:12:38 mtp-probe[23082]: bus: 1, device: 6 was not an MTP device
Jul 22 12:12:39 kernel: scsi 6:0:0:0: Direct-Access     TDKMedia Trans-It Drive   PMAP PQ: 0 ANSI: 0 CCS
Jul 22 12:12:39 kernel: sd 6:0:0:0: Attached scsi generic sg4 type 0
Jul 22 12:12:40 kernel: sd 6:0:0:0: [sdc] 7806976 512-byte logical blocks: (4.00 GB/3.72 GiB)
Jul 22 12:12:40 kernel: sd 6:0:0:0: [sdc] Write Protect is off
Jul 22 12:12:40 kernel: sd 6:0:0:0: [sdc] Mode Sense: 23 00 00 00
Jul 22 12:12:40 kernel: sd 6:0:0:0: [sdc] No Caching mode page found
Jul 22 12:12:40 kernel: sd 6:0:0:0: [sdc] Assuming drive cache: write through
Jul 22 12:12:40 kernel:  sdc: sdc1
Jul 22 12:12:40 kernel: sd 6:0:0:0: [sdc] Attached SCSI removable disk
 > lsblk --fs
sdc                                                                                      
└─sdc1      vfat   FAT32             A853-E68B                               3,7G     0% /run/media/xxx/A853-E68B
 > 
> mount | grep '/run/media/'
/dev/sdc1 on /run/media/xxx/A853-E68B type 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,uhelper=udisks2)
 > 

Therefore, any given KDE Plasma Dolphin instance will only be able to access the mounted device if “$USER” translates to the user who first mounted the device.

And, there’s the user protections FUSE places on any given Userspace Mount – <The Linux Kernel Documentation – FUSE>


If, it’s a multi-user system and, all the users have to access a given USB device which one of the users plugged into the system, I would tend to use “autofs” for this Use Case to work around the user protections associated with a Mount which lands in the ‘/run/media/’ directory tree.

Quoting the “fuse” man page –

SECURITY
       The fusermount3 program is installed set-user-gid to fuse. This is done to allow  users  from  fuse  group  to
       mount  their  own filesystem implementations.  There must however be some limitations, in order to prevent Bad
       User from doing nasty things.  Currently those limitations are:

       1.     The user can only mount on a mountpoint, for which it has write permission

       2.     The mountpoint is not a sticky directory which isn't owned by the user (like /tmp usually is)

       3.     No other user (including root) can access the contents of the mounted filesystem.

On the other hand, in ‘/etc/fuse.conf’ there’s this information – it’s also in the “mount.fuse3” man page –

# user_allow_other - Using the allow_other mount option works fine as root, in
# order to have it work as user you need user_allow_other in /etc/fuse.conf as 
# well. (This option allows users to use the allow_other option.) You need 
# allow_other if you want users other than the owner to access a mounted fuse. 
# This option must appear on a line by itself. There is no value, just the 
# presence of the option.

#user_allow_other

It’s work using relative path like

…/…/somepath

Thank you to everybody.

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