1. 方法一:
Create the following file as root:
/etc/polkit-1/rules.d/49-nopasswd_global.rules /* Allow members of the wheel group to execute any actions * without password authentication, similar to "sudo NOPASSWD:" */ polkit.addRule(function(action, subject) { if (subject.isInGroup("wheel")) { return polkit.Result.YES; } });
Replace wheel by any group of your preference.
This will result in automatic authentication for any action requiring admin rights via Polkit. As such, be careful with the group you choose to give such rights to.
网址:https://wiki.archlinux.org/index.php/Polkit#Mounting_storage_without_password
2.方法二:
/etc/polkit-1/rules.d/allow-mount-internal.rules:
/* Copy this to /etc/polkit-1/rules.d/allow-mount-internal.rules */ polkit.addRule(function(action, subject) { if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" || action.id == "org.freedesktop.udisks.filesystem-mount-system-internal") && subject.local && subject.active && subject.isInGroup("users")) { return polkit.Result.YES; } });
网址:https://gist.github.com/grawity/3886114#file-udisks2-allow-mount-internal-js