Generate ssh keys on source host with ssh-keygen
;api
Disable known_hosts prompt(optional): add "StrictHostKeyChecking no" into ~/.ssh/config;ssh
Run fabric script to distribute pubkey, you have to input password manually: fab distkey
;code
$ cat fabfile.pyorm
from fabric.api import local, taskip
env.hosts = ['10.0.2.48', '10.0.2.49', '10.0.7.141', '10.0.7.142', '10.0.7.143']input
@taskit
def distkey():io
env.user = 'gcp' local('ssh-copy-id %(user)s@%(host)s' % env)
You have to input password for every host. So try to use uniform password for all hosts. It will save you lots of times.form