Score:0

When using /etc/fstab how can I use the username in the folder path

us flag

Other drives are mounted in the /media/user folder. I would like to mount my windows share folder in my /media/user folder as well for consistency. I've tried $USER and $username, but both options only create folders call '$USER' and '$username' in the /media folder.

Is there a way that I can mount my share in the correct folder?

Terrance avatar
id flag
The problem is that it is mounting the drives before any user logs in, so there is no way it would know the username. You could however, setup some sort of script that you could run after logging in.
Marco avatar
br flag
Or use systemd userspace service, see `man 5 systemd-system.conf`
Hannu avatar
ca flag
or use a script - launched in `Startup Applications` - with `udisksctl mount --block-device /dev/$device;` in it.
Raffa avatar
jp flag
Does this answer your question? [Do "personal fstab" files exist for user accounts?](https://askubuntu.com/questions/364954/do-personal-fstab-files-exist-for-user-accounts)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.