Created
November 5, 2020 18:51
-
-
Save rafamdr/8981c6f713b2545941d6da319d7e7768 to your computer and use it in GitHub Desktop.
Execute multiple commands under another linux user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo -u devil -- sh -c "whoami; cd ~/ && pwd" | |
# Expected result | |
# devil | |
# /some/hell/path/devil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment