This is a small expect script that accepts unknown hosts as arguments and passes
'yes' to them, so they are automatically accepted in ~/.ssh/known_hosts
Ви не можете вибрати більше 25 тем
Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
|
- #!/usr/bin/expect -f
-
- # This is a small script that accept unknown hosts as arguments and passes
- # 'yes' to them, so they are automatically accepted in ~/.ssh/known_hosts
- #
- # Based on:
- # http://stackoverflow.com/questions/30206430/parsing-command-line-using-argc-and-argv-in-expect
- #
- # Usage: ./accept-yes.exp server1 server2 ...
-
- set count 0
- if { $argc ==0 } {
- puts "No arguments passed!\n"
- exit 1
- }
- foreach arg $argv {
- spawn ssh -l ubuntu $arg
- expect "(yes/no)?"
- send "yes\r"
- send "exit\r"
- incr count
- }
- puts "\n$count nodes have been accepted as known.\n"
|