Skip to content

Instantly share code, notes, and snippets.

@ljjjustin
Created August 16, 2018 02:27
Show Gist options
  • Select an option

  • Save ljjjustin/c05a8f1117ace45813b3fd9696769752 to your computer and use it in GitHub Desktop.

Select an option

Save ljjjustin/c05a8f1117ace45813b3fd9696769752 to your computer and use it in GitHub Desktop.
bootstrap ssh key
#!/usr/bin/expect -f
set host [ lindex $argv 0 ]
set timeout 10
set password xxxxxx
spawn ssh-copy-id root@${host}
expect {
"(yes/no)" { send "yes\r"; exp_continue }
"password:" { send "${password}\r" }
}
expect eof
LogLevel error
ServerAliveInterval 30
ServerAliveCountMax 6
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
IdentityFile ~/.ssh/id_rsa
Host *
ForwardAgent yes
ControlMaster auto
ControlPersist 600
ControlPath ~/.ssh/sock_%r@%h_%p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment