![]() |
how to connect over network and get the task done - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Networking (https://python-forum.io/forum-12.html) +--- Thread: how to connect over network and get the task done (/thread-37682.html) |
how to connect over network and get the task done - maiya - Jul-09-2022 Hi All, I have written a code snippet here. Where I wanted to connect a remote network, execute my script which is present in that system and get the output of that script. import paramiko ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(hostname = 'x.x.x.x', port = 22, username = 'admin', password = 'pass') stdin, stdout, stderr = ssh.exec_command('python /home/maiya/sample.py', get_pty = True) print(stdout.readlines()) ssh.close()what could be the issue in above code?, as am getting an error authentication failed. Any suggestion would really help. Thanks a lotRegards, maiya RE: how to connect over network and get the task done - Gribouillis - Jul-09-2022 Try to connect with allow_agent=False perhaps. Otherwise check that you can connect the remote host without Python, perhaps from Putty in Windows.
RE: how to connect over network and get the task done - maiya - Jul-09-2022 (Jul-09-2022, 07:23 AM)Gribouillis Wrote: Try to connect with Connection is there, however allow_agent = False helps actually. How to run the python script over ssh? RE: how to connect over network and get the task done - maiya - Jul-10-2022 (Jul-09-2022, 09:55 AM)maiya Wrote:(Jul-09-2022, 07:23 AM)Gribouillis Wrote: Try to connect with I got it!!! Thanks. |