sudo

How disable password authentication so you don’t have to type password

every time you want to install something

How to fix broken sudo - sudo: parse error in /etc/sudoers near line X

Use pkexec

pkexec vi /etc/sudoers/...

Running pkexec without a graphical agent fails even with falling back onto pkttyagent

https://github.com/NixOS/nixpkgs/issues/18012

running pkexec gives something like:

polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized

Workaround:

Note that to make it work, run pkttyagent in a different terminal binding to

the PID of the first terminal that is running pkexec.

In the first terminal run the following command to get its PID.

echo $$

In the second terminal run

pkttyagent --process PID_FROM_STEP_1

In the first terminal, do whatever you need to do with pkexec.