Skip to content

Instantly share code, notes, and snippets.

View sant123's full-sized avatar
🇨🇴

Santiago Aguilar Hernández sant123

🇨🇴
  • Gorilla Logic
  • Colombia
View GitHub Profile
@sant123
sant123 / 51-udisks2.rules
Last active September 26, 2024 03:17
Automount usb devices with systemd and udisks2
// Allow "your_user" to mount drives without authentication
polkit.addRule(function (action, subject) {
const isAction = action.id == "org.freedesktop.udisks2.filesystem-mount" ||
action.id == "org.freedesktop.udisks2.filesystem-unmount" ||
action.id == "org.freedesktop.udisks2.filesystem-mount-other-seat";
if (isAction && subject.user == "your_user") {
return polkit.Result.YES;
}