Created
December 7, 2016 00:42
-
-
Save amineasli/427dddf7df293c9a43bd453577ef063e to your computer and use it in GitHub Desktop.
To connect to remote servers using existing SSH keys and assuming a specific naming scheme for private keys (for example id_rsa-server_name)
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
#!/bin/bash | |
[ $# -eq 0 ] && { echo "Usage: $0 server"; exit 1; } | |
SERVER="$1" | |
SSH="/usr/bin/ssh" | |
USER="root" | |
IDENTITY="/root/.ssh/id_rsa-$SERVER" | |
$SSH $USER@$SERVER -i $IDENTITY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment