15/Feb 2017
1 min. read
must setup the localhost keygen generate keys for localhost
ssh-keygen -t rsa setup passwdless in remote servers the script set_pass.py is like below:
from fabric.api import * from fabric.contrib.files import * user = 'user' env.password = 'password' env.hosts=[] for ip in range(232, 240): env.hosts.append('%s@192.146.156.%d' % (user, ip)) def setpass(): local("rm -rf passwd_set/authorized_keys") home = os.getenv("HOME") with open("%s/.ssh/id_rsa.pub" % home, "r") as fr: key = fr.read() get("~/.ssh/*", "passwd_set/.") local("touch passwd_set/authorized_keys") exists1 = False with open("passwd_set/authorized_keys", "r") as fr: if key in fr.