runuser

Run commands as a specific user and group without asking for password (needs root privileges).

TLDR

Run command as a different user

>_ runuser [user] -c '[command]'
copy

Run command as a different user and group

>_ runuser [user] -g [group] -c '[command]'
copy

Start a login shell as a specific user

>_ runuser [user] -l
copy

Specify a shell for running instead of the default shell (also works for login)

>_ runuser [user] -s [/bin/sh]
copy

Preserve the entire environment of root (only if --login is not specified)

>_ runuser [user] --preserve-environment -c '[command]'
copy

Copied to clipboard
free 100$ digital ocean credit