Automount -> Remove password prompt

Hi,

I have an internal SSD that mounts automatically on my F41 KDE but, in order to access it I have to enter my su password everytime I log in.

Is there a way to remove that password step?
I’ve checked everything in the Automount option in the Settings so I’m assuming I have to work with the /etc/fstab config file but I’m not experienced enough to change anything there…

I expect it is an ownership & permissions issue.
What are the permissions if you use ls -ld <mount point> for that file system.
What are the permissions of the content of that file system? ls -ld <mount point>/*
What type file system is on that device? NTFS, ext4, vfat, or ?
Please also show us the content of /etc/fstab – especially the line that mounts that device. cat /etc/fstab

So, in order:

drwxrwxrwx. 1 admin admin 4096 Dec 28 13:20 /run/media/admin/Medias
dr-xr-xr-x.   1 root   root      0 Jul 16 20:00 /afs
lrwxrwxrwx.   1 root   root      7 Jul 16 20:00 /bin -> usr/bin
dr-xr-xr-x.   6 root   root   4096 Dec 29 16:55 /boot
drwxr-xr-x.  21 root   root   4900 Dec 31 08:15 /dev
drwxr-xr-x.   1 root   root   4764 Dec 30 20:55 /etc
drwxr-xr-x.   1 root   root     12 Dec 29 16:45 /home
lrwxrwxrwx.   1 root   root      7 Jul 16 20:00 /lib -> usr/lib
lrwxrwxrwx.   1 root   root      9 Jul 16 20:00 /lib64 -> usr/lib64
drwx------.   1 root   root      0 Oct 24 10:47 /lost+found
drwxr-xr-x.   1 root   root      0 Jul 16 20:00 /media
drwxr-xr-x.   1 root   root      0 Jul 16 20:00 /mnt
drwxr-xr-x.   1 root   root     40 Dec 29 22:35 /opt
dr-xr-xr-x. 607 root   root      0 Dec 31 03:14 /proc
dr-xr-x---.   1 root   root    252 Dec 30 20:57 /root
drwxr-xr-x.  56 root   root   1520 Dec 31 08:20 /run
drwxrwxrwx.   1 admin admin 4096 Dec 28 13:20 /run/media/admin/Medias
lrwxrwxrwx.   1 root   root      8 Jul 16 20:00 /sbin -> usr/sbin
drwxr-xr-x.   1 root   root      0 Jul 16 20:00 /srv
dr-xr-xr-x.  13 root   root      0 Dec 31 08:14 /sys
drwxrwxrwt.  21 root   root    500 Dec 31 08:30 /tmp
drwxr-xr-x.   1 root   root    100 Oct 24 10:50 /usr
drwxr-xr-x.   1 root   root    194 Oct 24 10:57 /var
ntfs
UUID=6ecbcde0-c453-4a3b-9030-cf530c851b40   /                           btrfs   subvol=root,compress=zstd:1   0 0 
UUID=386675e3-afa6-4ea2-9332-937c79688a0e   /boot                       ext4    defaults                      1 2 
UUID=2156-F9B2                              /boot/efi                   vfat    umask=0077,shortname=winnt    0 2 
UUID=6ecbcde0-c453-4a3b-9030-cf530c851b40   /home                       btrfs   subvol=home,compress=zstd:1   0 0 
/dev/nvme0n1p1                              /run/medias/admin/Medias   ntfs    nofail                        0 0

Let me know if I missed something, thanks!

The second command should have been ls -ld /run/media/admin/Medias/*. It appears you may have run that with a space preceding the ‘/*’ at the end.

However, since you are mounting an ntfs file system you should add some options in the fstab line. Note that with this I am assuming that your user has uid of 1000 and you might need to adjust the options for whatever your actual uid is. I also assume that you are the only user and you want full access for the admin user only. The id command will show your user uid and gid which are used below.

The options I would suggest are to change the line in fstab to read as follows.

/dev/nvme0n1p1                              /run/media/admin/Medias   ntfs    user,nofail,shortname=winnt,umask=0027,uid=1000,gid=1000,nosuid                        0 0

Use the man page for ‘mount’ to see what each of those options does.

For the second command, here’s the detail:

drwxrwxrwx. 1 admin admin 28672 Dec 11 22:12  /run/media/admin/Medias/Docs
drwxrwxrwx. 1 admin admin  4096 Dec 28 13:06  /run/media/admin/Medias/Music
drwxrwxrwx. 1 admin admin  4096 Dec 29 16:36 '/run/media/admin/Medias/System Volume Information'

As for fstab, I added your suggestion after checking my id (which is indeed 1000), but it didn’t work. After rebooting I had to enter my su password.

I just noticed an error in that path (I had copied what you had above and I fixed my suggestion).
It should be (on most fedora systems) /run/media/admin/<directory>
There was an error in the /etc/fstab in that respect.
Probably correcting that will fix it.

No it didn’t. After correcting the path, I still need to enter the password.

What happens if you remove the user option in that line from fstab?

1 Like

It worked!

Thanks a lot!

2 Likes

Unfortunately, when I turned my computer on today I had to re-enter my password again to access the drive.

Nothing changed in the fstab so I don’t know why it’s not working anymore.

Lets see lsblk -f and cat /etc/fstab

So, in order

NAME        FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
zram0                                                                               [SWAP]
nvme0n1                                                                             
├─nvme0n1p1 vfat   FAT32        2156-F9B2                             579.5M     3% /boot/efi
├─nvme0n1p2 ext4   1.0          386675e3-afa6-4ea2-9332-937c79688a0e  534.2M    38% /boot
└─nvme0n1p3 btrfs        fedora 6ecbcde0-c453-4a3b-9030-cf530c851b40    1.8T     3% /home
                                                                                    /
nvme1n1                                                                             
└─nvme1n1p1 ntfs         Medias 01DAD98E1CE6C480  
/etc/fstab
# Created by anaconda on Sun Dec 29 16:43:32 2024
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=6ecbcde0-c453-4a3b-9030-cf530c851b40   /                           btrfs   subvol=root,compress=zstd:1   0 0 
UUID=386675e3-afa6-4ea2-9332-937c79688a0e   /boot                       ext4    defaults                      1 2 
UUID=2156-F9B2                              /boot/efi                   vfat    umask=0077,shortname=winnt    0 2 
UUID=6ecbcde0-c453-4a3b-9030-cf530c851b40   /home                       btrfs   subvol=home,compress=zstd:1   0 0 
/dev/nvme0n1p1                              /run/media/admin/Medias    ntfs    nofail,shortname=winnt,umask=0027,uid=1000,gid=1000,nosuid   0 0

:thinking:
After a little bit of pondering, it seems that /run/media/admin may not exist until after the admin user has logged in. Probably the cause of the failure. The /run file system exists only in RAM and is created during boot.

The final solution probably would be to create a directory in your home directory named media then mount that file system there where you are certain the mount point exists at boot time.
mkdir ~/Medias
Then edit the line in /etc/fstab to mount that device at /home/admin/Medias instead of /run/media/admin/Medias.

It didn’t work, but I don’t know if I done it properly:

→ Created the Medias folder in /home/admin/Medias
→ Edited the fstab with the following:

UUID=6ecbcde0-c453-4a3b-9030-cf530c851b40   /                           btrfs   subvol=root,compress=zstd:1   0 0 
UUID=386675e3-afa6-4ea2-9332-937c79688a0e   /boot                       ext4    defaults                      1 2 
UUID=2156-F9B2                              /boot/efi                   vfat    umask=0077,shortname=winnt    0 2 
UUID=6ecbcde0-c453-4a3b-9030-cf530c851b40   /home                       btrfs   subvol=home,compress=zstd:1   0 0 
/dev/nvme0n1p1                              /home/admin/Medias         ntfs    nofail,shortname=winnt,umask=0027,uid=1000,gid=1000,nosuid                      0 0

After shutting down and booting, I still have to enter the password and when I check the drive’s properties its still located in /run/media/admin.

I was able to make it work.

After playing with KDE Partition Manager, I realized that for some reason the system kept changing the device node of the partition /dev/nvme0n1p1 (alternating between 0 / 1 / 2).

So I removed the mounting point and creating a new one, this time using the UUID instead of the device node.

Now, whether I’m rebooting or shutting down the system, the partition mounts automatically in /home.

Thanks a lot @computersavvy for your time and all your recommendations!

1 Like

This is the reason that UUIDs were created and are used.
Glad you were able to identify that issue. :+1:

1 Like