Setting Polkit for USB Automounting
Speedy and lightweight versions of Debian GNU/Linux are very popular among a wide range of computer users. In particular, the Lightweight X11 Desktop Environment (LXDE) offers a good looking, functional, but efficient desktop interface. Its most common file manager is PCManFM, and it works quite well.
There are some rather annoying problems experienced by users of PCManFM under a stripped down Debian / LXDE environment. Topping the list, and fixed below, is the issue of automounting USB plug in storage devices. As a normal (not root) user, plugging in a USB stick or SD card results in a "Not Authorized" message and denial of access to the device. However, a root user may mount the device and read or write to it. Policy Kit (aka "Polkit") is the main culprit here, and requires some tweaking to grant access to the normal user. There are some fixes posted to the internet, but most are short-term in nature. They involve editing the file /usr/share/polkit-1/actions/org.freedesktop.udisks.policy, which is overwritten during software upgrades. A more permanent solution, aside from the developers creating a more user friendly polkit, is to write the polkit tweaks into a separate file that will survive updates.
Follow the steps given below to fix polkit, and enable automatic mounting and access to USB storage devices. Carry out these actions as root:
- Open your file manager and navigate to the directory /etc/polkit-1/localauthority/50-local.d/
- Create a blank file named 55-storage.pkla
- Edit /etc/polkit-1/localauthority/50-local.d/55-storage.pkla to contain the following commands:
[Storage Permissions] Identity=unix-group:plugdev Action=org.freedesktop.udisks.filesystem-mount;org.freedesktop.udisks.drive-eject;org.freedesktop.udisks.drive-detach;org.freedesktop.udisks.luks-unlock;org.freedesktop.udisks.inhibit-polling;org.freedesktop.udisks.drive-set-spindown ResultAny=yes ResultActive=yes ResultInactive=no
When the file is saved, polkit will detect it and reconfigure user permissions.
#Advert: Supercharge your computing with systems and parts from MSI
- Add your user id to the group plugdev with the following usermod command:
usermod -a -G plugdev YOUR-USER-ID
- Log out and Log in (or reboot) and the new settings will be fully in effect.
That is it! A stripped down fast Linux system doesn\'t mean giving up the basic conveniences of computing. Simply configure polkit to do a proper job of enhancing and protecting your computing experience. PCManfm will manage files on your USB storage devices, and the "Not Authorized" messages will be a thing of the past!
Tags: debian lxde pluggable devices,polkit, policykit, debian bugs,lxde bugs