Skip to content

Instantly share code, notes, and snippets.

@g3rhard
Created August 24, 2022 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g3rhard/e76e16dda003ab2eec4feebc18533409 to your computer and use it in GitHub Desktop.
Save g3rhard/e76e16dda003ab2eec4feebc18533409 to your computer and use it in GitHub Desktop.
Privilege escalation wrapper for ansible from https://github.com/ansible/ansible/issues/12686#issuecomment-268535162
#!/bin/bash
# https://github.com/ansible/ansible/issues/12686#issuecomment-268535162
cmd=''
for i in "$@"; do
i="${i//\\/\\\\}"
cmd="$cmd \"${i//\"/\\\"}\""
done
sudo su - root << END
$cmd
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment