Skip to content

Instantly share code, notes, and snippets.

View KunalSin9h's full-sized avatar

Kunal Singh KunalSin9h

View GitHub Profile

These are only examples, for a few very common actions. You are expected to write your own rules for the rest. The syntax is regular JavaScript, but see the polkit(8) manpage for the object structure and available API. These examples are for polkit versions 106 and later, with the JS interpreter. They won't work with Debian's polkit v105.

  • If you don't know the action name, run pkaction:

    pkaction | grep cups
    
  • The possible results are YES, AUTH_SELF(_KEEP), AUTH_ADMIN(_KEEP), NO. Returning a result is final. Returning null will continue checking other rules.

  • Put your rules in /etc/polkit-1/rules.d/*.rules. (You can check everything in one giant addRule, or you can have a separate file and separate addRule for each program; it doesn't matter.)

@KunalSin9h
KunalSin9h / bash_strict_mode.md
Created August 3, 2023 15:39 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@KunalSin9h
KunalSin9h / Creating an AUR Package.md
Created May 9, 2023 08:02 — forked from keilmillerjr/Creating an AUR Package.md
How to create and manage an AUR package. #AUR #ARCH #makepkg #PKGBUILD

Editing remote files in Vim with SSH

  1. Configure SSH

    In ~/.ssh/config, include the lines:

    Host *
    ControlPath ~/.ssh/sockets/%r@%h-%p