How to mount drives without password?

Whenever I try to mount a partition in the hard disk (using Dolphin file manager), EndeavourOS (KDE) asks me for a password.

How can I mount drives without password?

Note: Unlike this post, I don’t want to auto mount drives at boot.

2 Likes

You can use gvfs - perhaps this only works for real removable storage - but anyway

gio mount -d /dev/sdyX

If your partition is not on removable device you could add the partitions in fstab adding user,noauto to the options section.

Another option is to use systemd unit(s) and complement the unit(s) with automount unit(s).

This option is useful in many ways

  • Predefined mountpoint
  • systemd mount on access
  • systemd umount when idle
  • Scripts don’t need to mount and unmount the device
  • Can be used with removable as well as fixed devices
  • Can be used with network file systems like webdav, ssh, ftp, smb
1 Like

Asks for password.

That will probably auto-mount the partition. In both Ubuntu and Manjaro, it is possible to mount a partition in the file manager without password, and without editing fstab.

As I said, I don’t want to automount. I just want to mount from the file manager, without entering password. I could not figure out if any of the above options would enable that.

Won’t adding noauto to mount options for entries in fstab work?

Now you are confusing me.

What is the functional difference of

  • automount when accessing the mountpoint (eject when done)
  • mount using the file manager without password (eject when done)

The unit approach has a timeout option - which will unmount the partition when idle for defined timeframe - e.g. 10s.

The addition of noauto,user to the fstab options for the partition is the equivalent of using a mount/automount unit combo - except that - I think - it won’t unmount.

EndeavourOS is not the same as Manjaro.

There is no special configuration on Manjaro - perhaps you just need to know which packages Manjaro utililzes in their build profiles?

Manjaro uses the package udiskie which pulls the dependency udisks2. Also the gvfs is installed. This combination may be what you seek.

pacman -Syu udiskie

By “automount” I meant “mount on login, or on boot”. Did you mean something else?

I installed it, but dolphin still asks me for password.

This is unclear to me. Please elaborate.

I know. I mentioned Manjaro to illustrate that it is certainly possible to mount a drive from file manager, without password.

I think this is similar to what you have in mind:

4 Likes

Automount means a partition gets mounted without user intervention triggered by clicking on a drive or partition or even configured to be mounted on boot. So when you say automount you need to be clear.

I think everything you need to understand what he said. Is in the post he linked you to earlier.

If you know then better to check what Majaro is using to achieve your expected behavior and try to replicate that in enos. Because you won’t find all the bells and whistles from Manjaro here.

Yes - the systemd method I suggest does not mount at boot time or login.

The system only mounts when you access the mountpoint and unmount after a configured idle time.

I am at loss with KDE - I am a :window: manager kind of guy - today I have a play with jwm - and I must say - I kind’a like it. It’s faster and to my surprise - simpler to configure than Openbox.

To my surprise I could even adjust myself to the use the mouseover activation of windows.

One question I thought I asked \:9 Which groups are your user member of? What is the output of

groups

Might be a bit more complicated than you want, but you could use a custom polkit rule to bypass sudo password authorization for mount actions.

https://wiki.archlinux.org/title/PolicyKit#Bypass_password_prompt

To achieve something similar to the sudo NOPASSWD option and get authorized solely based on user/group identity, you can create custom rules in /etc/polkit-1/rules.d/. This allows you to override password authentication either only for specific actions or globally.

See the list of available polkit actions …

$ pkaction 
3 Likes

And this is the right way IMHO. As long as you authorize the storage group, then whoever needs permission for mounting external drives is added to the group.

This method is for actual multiuser systems, that different users are different persons. For actually single user systems, there are many methods to do it.

So I guess the question is, how can this be done without me doing anything (applied from a distro)? A polkit rule sounds good. But still a (lazy/not-real-arch) user needs a HUGE informative banner… :rofl:

1 Like

This post solves it. Reboot is not required.

Thank you all for your help.

6 Likes

Great to hear!

:enos_flag:

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.