mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-22 01:02:09 +02:00
runuser: add page (#3283)
This commit is contained in:
parent
088cb7913a
commit
de4c03124e
1 changed files with 23 additions and 0 deletions
23
pages/linux/runuser.md
Normal file
23
pages/linux/runuser.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# runuser
|
||||||
|
|
||||||
|
> Run commands as a specific user and group without asking for password (needs root privileges).
|
||||||
|
|
||||||
|
- Run command as a different user:
|
||||||
|
|
||||||
|
`runuser {{user}} -c '{{command}}'`
|
||||||
|
|
||||||
|
- Run command as a different user and group:
|
||||||
|
|
||||||
|
`runuser {{user}} -g {{group}} -c '{{command}}'`
|
||||||
|
|
||||||
|
- Start a login shell as a specific user:
|
||||||
|
|
||||||
|
`runuser {{user}} -l`
|
||||||
|
|
||||||
|
- Specify a shell for running instead of the default shell (also works for login):
|
||||||
|
|
||||||
|
`runuser {{user}} -s {{/bin/sh}}`
|
||||||
|
|
||||||
|
- Preserve the entire environment of root (only if `--login` is not specified):
|
||||||
|
|
||||||
|
`runuser {{user}} --preserve-environment -c '{{command}}'`
|
Loading…
Add table
Reference in a new issue