USB DISK -- cannot access soft link when user change.


A usb stick with script and data is filled by user ‘user_1_vb’
One folder contains all common data :


this folder (000_COMMON) contains the following sub folders :


Somewhere else the software use this folder :


this folder (SYS_SCRIPT) contains the following sub folders :


To prevent duplicate data and/or not up-to-date data, the later folders are soft link to :


Dolphin is use to copy files and folders to the usb stick and to make link where it is needed.

The software is runnning correctly as long as the usb key is mounted by user ‘user_1_vb’

But on other computer it is another user who mounts the usb key.
The soft link continue to points to :


which does not exists.

The program itself run correctly because the use of a variable (LOG_NAME) which is fill by :


and script are called by


Any help is welcome.

It isn’t clear what you are asking.

It seems you are trying to solve a problem, but you have not told us what that problem is. Instead, you are telling us that your way of solving the problem isn’t working. You need to paint a broader picture for us.

You have not said how the USB is formatted. Since you mention soft links, I presume it uses a linux file system rather than a Windows file system. But you should not leave us guessing.

When a mounted file system uses symbolic links to another part of the same file system, consider using relative links.

Instead of

ln -s /mount/point/path/file ./code
you could try something like:

ln -s …/…/…/path/file .

That way, it won't matter where the drive is mounted.  If you get them right, the relative links should still work.

It seems difficult to do that from dolphin, because you have to edit individually the properties of all folders links and change real path to relative path.

Why HARD drives and USB drives are treated differently. For hard drives the name of the current user does not appear in the path. As a result the data is always at the same ‘somewhat address’.

It would be more simple if usb drive was mounted always in /run/media/usb-root-path-name as a long time ago.
I would like to be told how to do that if there is no other solutions.

Thank you for taking the time to respond.

PS : For this case, the usb stick is ntfs formated (Because it’s the first usb drive I found in my drawer.)

I added flash memory of the Forerunner® 735XT to /etc/fstab:

**erlangen:~ #** grep 735 /etc/fstab  
LABEL=FR**735**                                /FR**735**                  vfat   user,noauto                   0  0 
**erlangen:~ #**

Regardless of the user plugging in the device it gets mounted as:

**erlangen:~ #** df -h /FR735/ 
Filesystem      Size  Used Avail Use% Mounted on 
/dev/sdd         11M  7.1M  3.1M  71% /FR735 
**erlangen:~ #**

/run/media/ isn’t needed. But I think you can have it.

You seem to be very confused.

Using the expression “HARD drives and USB drives” is not saying anything.

There are different types of mass storage, e.g. revolving disks vs. static memory. This has nothing to do with what you experience as a difference. Once partitioned, file systems created, they are all the same when it comes to using them.

There are different types of hardware connections/buses in use, e.g. PCI vs. USB. You can have revolving disks on both. You can have static memory on both. Once you have a partitioned, file system created, mass-storage device connected through them, they are all the same when it comes to using them.

There are different file system types and what is more important there are Linux file systems and there are non-Linux file systems. The latter do not have the (POSIX standard required) user and group ownership and permissions. It is this non-Linux file system (like NTFS) that are at the root of your problems.

You should focus on how Linux tries to cope with non-Linux file systems like NTFS (by using fake user/group/permissions on mount), how the desktop is handling the spontaneous connection of such a file system for the desktop user “in the seat” and what this means on what you are trying to do.

You can do that, with an entry in “/etc/fstab”. Perhaps use Yast partitioner to set that up.

With the additional advice not to use a directory inside /run as mount point. That is against the File System Hierarchy ( Better create a mount point within /mnt, or direct within /, or another convenient place.

man udisks

The issue is /run/mount/username is not the best place to mount a USB that multiple users need to see.

I would umount the /run/mount/username usb drive
mkdir /usb
chmod 777 /usb
mount the usb drive on /usb

Now the permissions are everyone can see and change the USB drive.

You can script that so that it can be run at every reboot. you will need to do that as root or sudo.

For mounting a file system at boot, do we not have /etc/fstab already for ~ 50 years?

And did you take into account that this is about an NTFS file system and that thus some extra options should be used to give all users access?

What gave you this idea?

Typo. should be NTFS (post #4).

I am often at a loss with those MS terms. :frowning:

It shouldn’t make any difference if it is FAT, FAT32, NTFS, EXT4 - the problem is that /run/media/username - restricts access by other users
That path is owned by root - I think that is part of the problem - only username and root can see the USB drive.

LLR1:~ # ll /run/media/
total 0
drwxr-x---+ 2 root root 40 May 12 12:25 llrainey

If I know the UUID - yes I can mount it from /etc/fstab wherever I want it to go. I suspect the drive is not there at boot time and it mounts when the user logs on the box.
The issue is if the UUID of the USB is not there when the system boots /etc/fstab can hang the system.

Ahem, sorry. Didn’t the OP say it’s about a different machine?

But on other computer it is another user who mounts the usb key.

Missing fstab mounts are rather unwanted. I’d think nrickert’s first advice about relative paths should be the most appropriate, even if less convenient. Isn’t it?

My remark was on your advice to “automate” the mount on boot using a script (I assume starting it with systemd).
And of course when the file system is not always available there is no-fail.

In fact none of my posts above is directly related to the first post of the OP, because I hardly understand it.

I only started posting here on his casual remark that this is about a non-Linux file system. IMHO he does not see that as an important fact that he should have mentioned to his potential helpers in the first place. Then I stumbled into his wondering about the difference between"HARD drives and USB drives:. Then again, IMHO, he seems to lack a lot of understanding about devices, buses, partitioning, file systems (Linux vs. non-Linux) and mounting. I tried to explain a few basics. But I admit I still did not study his problem description in detail.

Maybe I am not goof enough in English to make myself understandable enough and I better refrain from posting here.

The only step actually needed is an entry in /etc/fstab. Systemd creates the mount automatically:

**erlangen:~ #** systemctl cat FR735.mount        
**# /run/systemd/generator/FR735.mount**
# Automatically generated by systemd-fstab-generator 

Documentation=man:fstab(5) man:systemd-fstab-generator(8) 

**erlangen:~ #**

Upon mount systemd will run an associated service:

**# /etc/systemd/system/FR735.service**
Description=Get FR735 Activities 

ExecStart=/usr/bin/rsync -av /FR735/ /home/karl/Forerunner/ 

**erlangen:~ #**

Whenever I attach the Forerunner for loading its battery activities stored on its flash memory will be synced automaticlly.

Hi Henk,

No offense meant! :wink:
I just wondered if there is another solution to original issue. I have tried to replace the user name in a soft link by the variable $USER but Dolphin doesn’t seem to take it.

Again, I do not understand the original problem, thus I can not comment on it or on any solution.

That need to have an fstab on all computer for all possible usb drive.

It would be more simple if usb drive was mounted always in /run/media/usb-root-path-name as a long time ago.