Tuesday, June 12, 2012

Tools to automate ssh-copy-id to remote servers

Well you can write scripts or if you prefer to use an open-source tools, you can use the sshpass from sourceforge.

According to ssh manpage

sshpass  is  a utility designed for running ssh using the mode referred to as "keyboard-interactive" password authentication, but in non-inter-active mode.

ssh  uses  direct  TTY  access to make sure that the password is indeed issued by an interactive keyboard user. Sshpass runs ssh in a dedicated tty, fooling it into thinking it is getting the password from an inter-active user.

The command to run is specified after sshpassâ own  options.  Typically it  will  be "ssh" with arguments, but it can just as well be any other command. The password prompt used by ssh is, however,  currently  hard-coded into sshpass.

Common example of use is

# sshpass -f password.txt ssh-copy-id user@remoteserver


No comments: