snippetbashTip
pkexec — Execute commands as another user. Asks for password in a GUI if available. See also: `sudo`, `run0`,
Viewed 0 times
commandcommandsanotherasksexecutecliuserpkexec
linux
Problem
How to use the
pkexec command: Execute commands as another user. Asks for password in a GUI if available. See also: sudo, run0, doas. More information: <https://polkit.pages.freedesktop.org/polkit/pkexec.1.html>.Solution
pkexec — Execute commands as another user. Asks for password in a GUI if available. See also: sudo, run0, doas. More information: <https://polkit.pages.freedesktop.org/polkit/pkexec.1.html>.Run command as root:
pkexec {{command}}Switch user to root:
pkexecRun command as a specific user:
pkexec --user {{username}} {{command}}Code Snippets
Run command as root
pkexec {{command}}Switch user to root
pkexecRun command as a specific user
pkexec --user {{username}} {{command}}Context
tldr-pages: linux/pkexec
Revisions (0)
No revisions yet.