Forrest logo
tool overview
On this page you find all important commands for the CLI tool runuser. If the command you are looking for is missing please ask our AI.

runuser

The runuser command line tool is a utility available on Unix-like systems, including Linux, that enables running commands or applications with a different user identity. It allows switching to a different user account without logging out completely. The general syntax for the runuser command is "runuser [options] user -- command".

The command requires superuser privileges to switch to another user account. It is often used by system administrators to perform administrative tasks or test applications with different user privileges. The user parameter specifies the username or UID of the target account.

Options can be used to specify a different group, change the environment, set the working directory, or suppress error messages. By default, runuser sets the environment variables to match the target user account.

The runuser command is useful for troubleshooting and diagnosing issues related to user permissions and access controls. It provides a convenient way to switch to another user account without the need to log out and log back in.

List of commands for runuser:

  • runuser:tldr:118f4 runuser: Run command as a different user and group.
    $ runuser ${user} -g ${group} -c '${command}'
    try on your machine
    explain this command
  • runuser:tldr:14c38 runuser: Start a login shell as a specific user.
    $ runuser ${user} -l
    try on your machine
    explain this command
  • runuser:tldr:4e679 runuser: Preserve the entire environment of root (only if `--login` is not specified).
    $ runuser ${user} --preserve-environment -c '${command}'
    try on your machine
    explain this command
  • runuser:tldr:c6882 runuser: Run command as a different user.
    $ runuser ${user} -c '${command}'
    try on your machine
    explain this command
  • runuser:tldr:fc57f runuser: Specify a shell for running instead of the default shell (also works for login).
    $ runuser ${user} -s ${-bin-sh}
    try on your machine
    explain this command
tool overview