Created
September 19, 2016 23:29
-
-
Save ericblue/6e973c2791763a903269746d1f59cb8a to your computer and use it in GitHub Desktop.
Add new SSH trusted host key
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/sh | |
# Deploys new authorized key from id_rsa.pub via SSH so new SSH connections will not require password authentication | |
# Example: cd ~/user; ./deploy_ssh_key.sh [email protected] | |
if [ $# -lt 1 ] | |
then | |
echo "Usage: $0 <user@hostname>"; | |
exit 1; | |
fi | |
echo "Copying id_rsa.pub to $1 authorized keys" | |
cat ~/.ssh/id_rsa.pub | ssh $1 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment