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.
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.
With the additional advice not to use a directory inside /run as mount point. That is against the File System Hierarchy (Filesystem Hierarchy Standard - Wikipedia). Better create a mount point within /mnt, or direct within /, or another convenient place.
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.
No offense meant!
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.