Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try:
- ssh_client=paramiko.SSHClient()
- pk=paramiko.RSAKey.from_private_key_file(path)
- ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh_client.connect(hostname=hostname, port=port, username=username, password=password,pkey=pk)
- ssh_stdin, ssh_stdout, ssh_stderr = ssh_client.exec_command(postgresquery)
- print('Tunnel connected')
- for line in ssh_stdout.readlines(): #terminal never get past this line of code. And is not either possible to terminate the script
- print(line)
- ssh_client.close()
- except:
- print("Connection failed")
Add Comment
Please, Sign In to add comment