Created
May 21, 2019 15:44
-
-
Save davidpelfree/e0674bac042fa289cd6e15cc8668ad1a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
set -ex | |
# I am on server A | |
sshpass -e ssh -o PubkeyAuthentication=no -o StrictHostKeyChecking=no "${SSH_USERNAME}@${SERVER_B}" <<EOF | |
# Now I am on server B | |
export SSH_USERNAME=$SSH_USERNAME # Copy env. variable from server A to server B | |
export SERVER_C=$SERVER_C # Copy env. variable from server A to server B | |
export SSHPASS=$SSHPASS # INSECURE!! copy env. variable from server A to server B | |
sshpass -e ssh -o PubkeyAuthentication=no -o StrictHostKeyChecking=no "${SSH_USERNAME}@${SERVER_C}" <<EOF2 | |
# Now I am on server C | |
EOF2 | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment