runuser
systemLinux
The runuser command is one of the most frequently used commands in Linux/Unix-like operating systems. runuser Run a command with substitute user and group ID
Quick Reference
Command Name:
runuser
Category:
system
Platform:
Linux
Basic Usage:
runuser [options] [arguments]
Common Use Cases
Syntax
runuser [options] -u user [--] [command [args...]]
Options
| Option | Description |
|---|---|
-c, --command=COMMAND |
Pass a single command to the shell with -c |
-f, --fast |
Pass -f to the shell (for csh or tcsh) |
-g, --group=GROUP |
Specify the primary group |
-G, --supp-group=GROUP |
Specify a supplemental group |
-l, --login |
Make the shell a login shell |
-m, -p, --preserve-environment |
Preserve environment variables |
-s, --shell=SHELL |
Run the specified shell instead of the default |
-u, --user=USER |
The user to run as (required) |
-w, --whitelist-environment=LIST |
Pass only specified variables to the new environment |
--session-command=COMMAND |
Pass a single command to the shell with -c and don't create a new session |
-h, --help |
Display help information and exit |
-V, --version |
Output version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the runuser command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.