-
-
Save greenkey/a6d87081a55efa8b8b1e to your computer and use it in GitHub Desktop.
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 | |
if [ ! -f ~/.ssh/id_rsa.pub ]; then | |
ssh-keygen | |
fi | |
echo "Server host:" | |
read SRV | |
echo "User on the server host:" | |
read USR | |
ssh $USR@$SRV 'mkdir .ssh; chmod 700 .ssh; touch .ssh/authorized_keys2; chmod 640 .ssh/authorized_keys2' | |
cat ~/.ssh/id_rsa.pub |ssh $USR@$SRV 'cat >> .ssh/authorized_keys2' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
AFAIK This does the same thing as the command
ssh-copy-id