Search

How to Mount Partition Without Authentication on Linux

Quick tip.


How to Mount Partition Without Authentication on Linux

When will you access a partition via graphical interface on some systems like Gentoo and Debian, for example, you are asked to enter your sudo or root as in the example below: GNOME authentication

In the case of a window manager, such as bspwm by example, if you have not started Polkit manually or in your login file it does not open Gksudo and shows an error similar to the image shown below: Unable - bspwm

But you can configure it to mount automatically without asking for a password, as follows:

On Gentoo:

Open the file /usr/share/polkit-1/actions/org.freedesktop.UDisks2.policy

sudo vim /usr/share/polkit-1/actions/org.freedesktop.UDisks2.policy

No Debian:

Open the file /usr/share/polkit-1/actions/org.freedesktop.UDisks2.policy

sudo vim /usr/share/polkit-1/actions/org.freedesktop.UDisks2.policy

And in the excerpt (<action id="org.freedesktop.udisks2.filesystem-mount-system">, in the defaults tag) similar to the one below, replace the information: auth_admin with yes

<action id="org.freedesktop.udisks2.filesystem-mount-system">
    <description>Mount a filesystem on a system device</description>
    <description xml:lang="zh_TW">在系統裝置掛載檔案系統</description>
    <description xml:lang="zh_CN">在系统设备上挂载文件系统</description>
    <description xml:lang="uk">Змонтувати файлову систему на пристрої зберігання системи</description>
    <description xml:lang="tr">Bir sistem aygıtı üzerinde bir dosya sistemi bağla</description>
    ....
    <defaults>
    <allow_any>auth_admin</allow_any>
    <allow_inactive>auth_admin</allow_inactive>
    <allow_active>auth_admin_keep</allow_active>
    </defaults>
</action>

Changing like this:

<action id="org.freedesktop.udisks2.filesystem-mount-system">
    <description>Mount a filesystem on a system device</description>
    <description xml:lang="zh_TW">在系統裝置掛載檔案系統</description>
    <description xml:lang="zh_CN">在系统设备上挂载文件系统</description>
    <description xml:lang="uk">Змонтувати файлову систему на пристрої зберігання системи</description>
    <description xml:lang="tr">Bir sistem aygıtı üzerinde bir dosya sistemi bağla</description>
    ....
    <defaults>
    <allow_any>yes</allow_any>
    <allow_inactive>yes</allow_inactive>
    <allow_active>yes</allow_active>
    </defaults>
</action>

Then you don’t even need to restart anything, just try to mount from now on

If you can’t, try to change the file that contains Udisk or ** udisk2 **

In i3wm, if you want me to ask for a password instead of automatically assembling, add this line to your config: exec_always --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &, in the case of Debian.

About Polkit

Polkit is a component for controlling system-wide privileges on Unix-like operating systems. It provides an organized way for non-privileged processes to communicate with the privileged. Polkit allows a level of control over centralized system policy.

Since version 0.105, launched in April 2012, the project’s name has been changed from PolicyKit to polkit to emphasize that the system component has been rewritten and that the API has been changed, breaking backward compatibility, learn more.


linux tips polkit


Share



Comments