Create a gist now

Instantly share code, notes, and snippets.

anonymous /gist:23ccb223b9b41ca8a470 Secret
Created Jun 20, 2015

What would you like to do?
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