Created
September 19, 2012 07:42
-
-
Save wangshijun/3748233 to your computer and use it in GitHub Desktop.
shell: build trust relations between linux hosts
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 | |
# build trust relations between linux hosts | |
user="wangshijun" | |
machine="hostname1 hostname2 hostname3" | |
for i in $machine | |
do | |
scp ~/.ssh/id_rsa.pub ${user}@$i:./ | |
ssh ${user}@$i 'cat id_rsa.pub >>.ssh/authorized_keys; chmod 700 .ssh;chmod 600 .ssh/authorized_keys' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment