Skip to content

Instantly share code, notes, and snippets.

@ljjjustin
Created March 21, 2019 07:22
Show Gist options
  • Save ljjjustin/8323a2c8cf3790b462658738e360cd03 to your computer and use it in GitHub Desktop.
Save ljjjustin/8323a2c8cf3790b462658738e360cd03 to your computer and use it in GitHub Desktop.
copy ssh id
#!/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