Created
March 21, 2019 07:22
-
-
Save ljjjustin/8323a2c8cf3790b462658738e360cd03 to your computer and use it in GitHub Desktop.
copy ssh id
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 | |
ssh_copy_id() { | |
host=$1 | |
pass=$2 | |
expect <<-EOF | |
spawn ssh-copy-id root@${host} | |
expect { | |
"*yes/no*" { send "yes\r"; exp_continue } | |
"*password*" { send "${pass}\r"; } | |
} | |
expect eof | |
EOF | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment