Last active
August 29, 2015 14:06
-
-
Save eran132/2ce8bb567e317e51b2e6 to your computer and use it in GitHub Desktop.
Set single sign-on to SSH servers
This file contains hidden or 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
#First make sure you have expect package installed | |
#Prepare the ip addresses list using NMAP | |
#!/usr/bin/expect | |
set hostlist [open /path/to/ip_addresses_of_hosts_with_ssh_daemon.txt] | |
set ipaddrs [read $hostlist] | |
foreach line [split $ipaddrs \n] { | |
spawn ssh-copy-id user@$line | |
set pass "password" | |
expect { | |
"yes/no" {send "yes\r"} | |
password: {send "$pass\r"; exp_continue} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment