Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save boywijnmaalen/49e271ac7bb11effabc9 to your computer and use it in GitHub Desktop.
Save boywijnmaalen/49e271ac7bb11effabc9 to your computer and use it in GitHub Desktop.
How to execute a command as a different user
# execute command on behave of another user
$ su -s /bin/sh <username> -c "whoami"
# become another user:
$ sudo su - <username>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment