Tag Archives: storage

usb mount and policykit [EN]

When you’re not on the ‘Desktop Environment‘ side and rather be in light linux config, you have to deal with annoying little problems. I’m using DWM as my tiled window manager and loving it for years. It’s fast, flexible and fun. My linux desktop is up and running after a few seconds… (ok, thanks also to the ssd 🙂 ).

But, after I upgraded to Ubuntu 14.04, I’ve lost the ability to mount my usb disks with the file manager (same problem with Nautilus or Thunar). I’m getting this frustrating “not authorized” message.
My work around was to ‘pmount’ the disk. It works but I need to search for the right device before, with dmesg, then provide the right syntax. Not so fun.

After digging a while, I found out that authorizations are managed with policykit. So after reading man page after man page, posts after posts, I found a way to easily mount my usb disks in my file manager.

Just edit a new policykit config file :

sudo nano /etc/polkit-1/localauthority/50-local.d/55-myconf.pkla

The number and the .pkla extension are mandatory to respect. The name ‘myconf’ is as you will.
Inside this file, insert those lines :

[Dealing with disks]
Identity=unix-group:plugdev
Action=org.freedesktop.udisks2.filesystem-mount;org.freedesktop.udisks2.eject-media;org.freedesktop.ud$
ResultAny=yes
ResultInactive=yes
ResultActive=yes

Now, we have to restart DBUS as it’s the service that launch the polkitd daemon

sudo restart dbus

If you launch, as I do, gnome-settings-daemon manually, you need to relaunch it after dbus

gnome-settings-daemon -r &

That’s it ! Plug a usb drive and use your file manager to browse it. No more ‘not authorized’ message !