Stop asking for authentication to mount USB stick

18,578

Solution 1

Try this. Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo gedit /usr/share/polkit-1/actions/org.freedesktop.udisks2.policy

When it opens look for

<action id="org.freedesktop.udisks2.filesystem-unmount-others">
<defaults>
      <allow_any>auth_admin</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>auth_admin_keep</allow_active>
</defaults>

And change it to

<action id="org.freedesktop.udisks2.filesystem-unmount-others">
<defaults>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
</defaults>

Solution 2

I had the same problem with mounting on one of my systems. I tried using @Mitch approach above which didn't work for me (Although it may work great if you have the unmounting issue) . I took a similar approach to begin with and

sudo gedit /usr/share/polkit-1/actions/org.freedesktop.udisks2.policy

but changed this section

<defaults>
      <allow_any>auth_admin</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>

of

<action id="org.freedesktop.udisks2.filesystem-mount">

to

 <defaults>
      <allow_any>no</allow_any>
      <allow_inactive>no</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>

matching content found in the old

/usr/share/polkit-1/actions/org.freedesktop.udisks.policy

Sources: @Mitch answer above

     `/usr/share/polkit-1/actions/org.freedesktop.udisks.policy`

     https://forum.kde.org/viewtopic.php?f=22&t=112092

Testing

Solution 3

I had the same problem today; "all of a sudden" my 14.04 wanted my password for "everything"; including (un)mount of USB sticks.

I figured that I installed openssh-server in the morning. After removing it, everything is back to normal; I can insert a USB stick; and it is mounted without asking for a password. Strange. Just tried to repro; installed openssh-server again; and no ... no such effect this time.

Share:
18,578

Related videos on Youtube

markus_b
Author by

markus_b

Swiss Engineer

Updated on September 18, 2022

Comments

  • markus_b
    markus_b almost 2 years

    My Ubuntu 14.04 is asking for my password to mount or unmount an USB stick. How can I change it, so that the mount is automatic and no password input is required ?

    This is about mounting arbitrary USB sticks in /media, there is no entry in /etc/fstab. My user is in the 'plugdev' group, but the password prompt is pupping up anyway.

  • GhostCat
    GhostCat almost 9 years
    Follow up question: I see that this string <allow_active>... shows up 29 times in that files - do you recommend to replace them all; if not; which section is the correct one to update?
  • Sanjay Manohar
    Sanjay Manohar almost 9 years
    Thanks. Please could someone advise if there is a way to edit this in a user-friendly manner? The XML seems to be designed to have a front-end, doesn't it?
  • Sanjay Manohar
    Sanjay Manohar almost 9 years
    Also, does anyone know what "attached to another seat means"? I had this problem suddenly. Could it be that ubuntu thinks my drive is in a different "seat"?
  • lepe
    lepe over 8 years
    When the dialog (for password) is shown, see at "details". It should show something like: "org.freedesktop.udisks2.filesystem-mount". That is the rule you need to change. I had "yes" in "allow_active", so I set "yes" also in the other two (allow_any and allow_inactive). Now the dialog is not shown. BTW, I checked the udisk documentation and found no interface for those options. I agree... there must be one.
  • lepe
    lepe over 8 years
    I'm almost sure, that you could add such rule in /etc/polkit-1/... (see this link: forum.kde.org/viewtopic.php?f=22&t=112092)
  • Elder Geek
    Elder Geek over 8 years
    This did not work for me at all. Perhaps if you could clarify by following up on Jägermeister comment and edit this answer it would be useful to many of us. As it is, not so much. Is a reboot required?
  • Mitch
    Mitch over 8 years
    @ElderGeek Answer updated, hope it helps.
  • Elder Geek
    Elder Geek over 8 years
    It did help me figure out how to solve the mount side of the problem. Thanks! ;-)
  • Ángel
    Ángel over 7 years
    Just changing <allow_active>auth_admin_keep</allow_active> to <allow_active>yes</allow_active>would be enough, since you are (un)mounting from the active session.
  • Emiter
    Emiter over 3 years
    What is the point of editing files in /usr ? It will be overriden on next update. I guess proper way of doing it is editing something in /etc. But I don't know exactly what and where
  • Admin
    Admin about 2 years
    udisks* -> UDisks* on some distros.