I am creating one user and want to set the ssh key for that user
My script is
import paramiko
ssh_conn = paramiko.SSHClient()
ssh_conn.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_conn.load_system_host_keys()
ssh_conn.connect('localhost', username='test', password='test')
cmd = 'ssh-keygen -t dsa'
stdin, stdout, stderr = ssh_conn.exec_command(cmd)
stdin.write('\n')
stdin.flush()
stdin.write('\n')
stdin.flush()
stdin.write('\n')
stdin.flush()
print "Output: ", stdout.read()
But its seems not working
When i run it as single statement copy past on python console then it works but when i run it as single python script it hang at last line print "Output: ", stdout.read().
Thx in advance for your help 🙂
Before attempting to read the
stdoutissue:See also this question for reference.