-
-
Save anonymous/23ccb223b9b41ca8a470 to your computer and use it in GitHub Desktop.
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
function runasuser { | |
echo $1 | |
echo $2 | |
sudo -H -u $1 bash -c '$2'; | |
} | |
export -f runasuser | |
runasuser tom "ls -al /" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment