in reply to Populating authorized_keys with Expect

You are not automating the process too much as the script is still querying the user for her password...

You can do the same with just some shell lines:

$hosts ="host1 host2 host3" # use ssh-keyscan to populate your "known_hosts" file first: ssh-keyscan $hosts >>~/.ssh/known_hosts # then append your key on the remote hosts: for h in $hosts do echo "*** copying key to $h ***" cat ~/.ssh/id_rsa.pub | ssh $h 'cat >>~/.authorized_hosts' done
update: read also ssh-copy-id man page!