runuser
Run commands as a different user
TLDR
Run command as different user
SYNOPSIS
runuser [-l] [-c command] [-g group] [-s shell] [-p] user
DESCRIPTION
runuser runs commands as another user without requiring password authentication. Unlike su, it's designed for use by root in system scripts and services where interactive authentication isn't appropriate.
The tool is commonly used in init scripts and system services to drop privileges to a specific user before executing commands.
PARAMETERS
-c, --command _command_
Command to execute-g, --group _group_
Specify group-l, --login
Start login shell-s, --shell _shell_
Use specific shell-p, --preserve-environment
Keep environment variables-w, --whitelist-environment
Preserve specific variables
CAVEATS
Requires root to run. No password prompt (unlike su). Environment handling depends on options. Login shell resets most environment.
HISTORY
runuser is part of util-linux, providing a non-interactive way for root to run commands as other users. It's preferred over su in scripts due to its predictable behavior.
