Skip to content

Instantly share code, notes, and snippets.

@alanmquach
Created July 17, 2014 06:44
Show Gist options
  • Save alanmquach/062c56754f1bca05857a to your computer and use it in GitHub Desktop.
Save alanmquach/062c56754f1bca05857a to your computer and use it in GitHub Desktop.
Expect wrapped ssh command to put public key onto a server
/usr/bin/expect -c "set timeout 60; spawn ssh ${SSH_OPTS} ${USERID}@${HOST} \"mkdir -p ~/.ssh && echo \\\"`cat ~/.ssh/id_rsa.pub`\\\" >> ~/.ssh/authorized_keys\"; expect \"*?assword:*\"; send -- \"${PASSWD}\r\"; expect eof"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment