run0
(1)Elevate privileges
Options
16--unitUse this unit name instead of an automatically generated one. Added in version 256.
--propertySets a property of the service unit that is created. This option takes an assignment in the same format as systemctl(1)'s set-property command. Added in version 256.
--descriptionProvide a description for the service unit that is invoked. If not specified, the command itself will be used as a description. See Description= in systemd.unit(5). Added in version 256.
--sliceMake the new .service unit part of the specified slice, instead of user.slice. Added in version 256.
--slice-inheritMake the new .service unit part of the slice the run0 itself has been invoked in. This option may be combined with --slice=, in which case the slice specified via --slice= is placed within the slice the run0 command is invoked in. Example: consider run0 being invoked in the slice foo.slice, and the --slice= argument is bar. The unit will then be placed under foo-bar.slice. Added in version 256.
-u-g--user--groupSwitches to the specified user/group instead of root. Added in version 256.
--niceRuns the invoked session with the specified nice level. Added in version 256.
-D--chdirRuns the invoked session with the specified working directory. If not specified defaults to the client's current working directory if switching to the root user, or the target user's home directory otherwise. Added in version 256.
--setenvNAMERuns the invoked session with the specified environment variable set. This parameter may be used more than once to set multiple variables. When "=" and VALUE are omitted, the value of the variable with the same name in the invoking environment will be used. Added in version 256.
--backgroundCOLORChange the terminal background color to the specified ANSI color as long as the session lasts. If not specified, the background will be tinted in a reddish tone when operating as root, and in a yellowish tone when operating under another UID, as reminder of the changed privileges. The color specified should be an ANSI X3.64 SGR background color, i.e. strings such as "40", "41", ..., "47", "48;2;...", "48;5;...". See ANSI Escape Code (Wikipedia)[2] for details. Set to an empty string to disable. Example: "--background=44" for a blue background. Added in version 256.
--pty--pipeRequest allocation of a pseudo TTY for the run0 session (in case of --pty), or request passing the caller's STDIO file descriptors directly through (in case of --pipe). If neither switch is specified, or if both switches are specified, the mode will be picked automatically: if standard input, standard output and standard error output are all connected to a TTY then a pseudo TTY is allocated, otherwise the relevant file descriptors are passed through directly. Added in version 257.
--shell-prompt-prefixSTRINGSet a shell prompt prefix string. This ultimately controls the $SHELL_PROMPT_PREFIX environment variable for the invoked program, which is typically imported into the shell prompt. By default – if emojis are supported –, a superhero emoji is shown (🦸). This default may also be changed (or turned off) by passing the $SYSTEMD_RUN_SHELL_PROMPT_PREFIX environment variable to run0, see below. Set to an empty string to disable shell prompt prefixing. Added in version 257.
--machineExecute operation in a local container. Specify a container name to connect to. Added in version 256.
--no-ask-passwordDo not query the user for authentication for privileged operations.
-h--helpPrint a short help text and exit.
--versionPrint a short version string and exit.
DESCRIPTION
run0 may be used to temporarily and interactively acquire elevated or different privileges. It serves a similar purpose as sudo(8), but operates differently in a couple of key areas:
Altogether this should provide a safer and more robust alternative to the sudo mechanism, in particular in OS environments where SetUID/SetGID support is not available (for example by setting the NoNewPrivileges= variable in systemd-system.conf(5)).
Any session invoked via run0 will run through the "systemd-run0" PAM stack.
Note that run0 is implemented as an alternative multi-call invocation of systemd-run(1). That is, run0 is a symbolic link to systemd-run executable file, and it behaves as run0 if it is invoked through the symbolic link, otherwise behaves as systemd-run.
EXIT STATUS
ENVIRONMENT VARIABLES
As with systemd-run, the session will inherit the system environment from the service manager. In addition, the following environment variables will be set:
$TERM
Added in version 256.
$SUDO_USER
Added in version 256.
$SUDO_UID
Added in version 256.
$SUDO_GID
Added in version 256.
$SHELL_PROMPT_PREFIX
Added in version 257.
The following variables may be passed to run0:
$SYSTEMD_RUN_SHELL_PROMPT_PREFIX
Added in version 257.