Skip to content

Instantly share code, notes, and snippets.

@iqueryable
Last active November 26, 2020 01:03
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 iqueryable/475c9c73f539b7a3a89ad5525fb87512 to your computer and use it in GitHub Desktop.
Save iqueryable/475c9c73f539b7a3a89ad5525fb87512 to your computer and use it in GitHub Desktop.
# SSH agent forward as root user
docker run --rm -it \
-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK \
-e SSH_AUTH_SOCK=$SSH_AUTH_SOCK \
ubuntu:20.04 /bin/bash
# SSH agent forward as non-root user
docker run --rm -it \
-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK \
-e SSH_AUTH_SOCK=$SSH_AUTH_SOCK \
-e UID=$(id -u) \
ubuntu:20.04 /bin/bash -c 'useradd -m -u $UID non-root -s /bin/bash; su non-root;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment