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
- openSUSE | SDB Mount additional disk – https://en.opensuse.org/SDB:Mount_additional_disk
- Stop Ubuntu asking for password to mount second drive – https://askubuntu.com/questions/445224/stop-ubuntu-asking-for-password-to-mount-second-drive
- How can I turn off password prompt when mounting another hard drive? I want mounting (and mounted partitions) to be accessible without root privileges | Reddit – https://www.reddit.com/r/openSUSE/comments/c9ljd4/how_can_i_turn_off_password_prompt_when_mounting/