Monday, February 13, 2012

Udisks: Mount Devices Without Password Prompt


I like being able to quickly access my plugged in devices through Dolphin by simply clicking on them in the sidebar. However everytime I do this it keeps asking me for my password. Thankfully it is very easy to get rid of this annoyance.

Since I am running pretty much a full Kde4 desktop, I'll just assume that you will have some kind of policykit/polkit agent installed. Almost all distributions have one installed by default, however since I run Arch Linux this might not always be the case.


Directly modifying the polkit udisk policy

We will be editing this file:
/usr/share/polkit-1/actions/org.freedesktop.udisks.policy

What have to edit in here is usually located under the second id. This is not always the case, so make sure that you are editing the right id.

/usr/share/polkit-1/actions/org.freedesktop.udisks.policy
---------------------------------------------------------
<action id="org.freedesktop.udisks.filesystem-mount-system-internal">
<description>Mount a system-internal device</description>
<description xml:lang="da">Montér en intern enhed</description>
<message>Authentication is required to mount the device</message>
<message xml:lang="da">Autorisering er påkrævet for at montere et fil system</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>

The line we are looking for is:
<allow_active>admin_auth_keep</allow_active>

Which we will change to:
<allow_active>yes</allow_active>

This final result should be similar to this:
/usr/share/polkit-1/actions/org.freedesktop.udisks.policy
---------------------------------------------------------
<action id="org.freedesktop.udisks.filesystem-mount-system-internal">
<description>Mount a system-internal device</description>
<description xml:lang="da">Montér en intern enhed</description>
<message>Authentication is required to mount the device</message>
<message xml:lang="da">Autorisering er påkrævet for at montere et fil system</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>

Keep in mind that you may have to logout/login to make these changes take effect.

Now when I click on a device in the Dolphin sidebar it automatically mounts that device without prompting me for a password. Which is how it should have worked in the first place if you ask me.

No comments:

Post a Comment