Created
July 17, 2014 06:44
-
-
Save alanmquach/062c56754f1bca05857a to your computer and use it in GitHub Desktop.
Expect wrapped ssh command to put public key onto a server
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
/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