Stop asking password when mounting another internal hard drive on Linux

Whenever I change the operating system or update, we find that in order to access the additional internal hard drives in our machines, we must necessarily type the administrator password. How boring!

Let’s see how to overcome this annoying procedure and how to stop the operating system from asking password when mounting another internal hard drive on Linux.

First of all, it will already be clear to everyone that this is a question of permissions, then immediately we go to the fstab and we add our group. It is easy, simply add the 'user' group option to the /etc/fstab line relative to the partition of the interesting hard drive.

Something like this:

/dev/sdc1 /data ext4 rw,noauto,nofail,nodev,nosuid,user

It is so simple, but it doesn’t always work, so here comes a useful and longer-lasting solution.

Open the file /etc/polkit-default-privs.local with this command:

$ sudo vim /etc/polkit-default-privs.local

Add these lines in that file:

org.freedesktop.udisks2.filesystem-mount-system auth_admin:auth_admin:yes

org.freedesktop.udisks2.filesystem-mount auth_admin:auth_admin:yes

And, at the end, run this command in the terminal session:

$ sudo set_polkit_default_privs

Then you can mount other drives in your file manager without needing to enter the root password every time.

References and resources

Leave a Reply

Your email address will not be published. Required fields are marked *