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.
Regards,
maiya
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.
Error:PS C:\Users\maiya\test> python connect.py
Traceback (most recent call last):
File "C:\Users\maiya\test\connect.py", line 6, in <module> ssh.connect(hostname = 'x.x.x.x', port = 22, username = 'admin', password = 'pass')
File "C:\Users\maiya\AppData\Roaming\Python\Python310\site-packages\paramiko\client.py", line 435, in
connect
self._auth(
File "C:\Users\maiya\AppData\Roaming\Python\Python310\site-packages\paramiko\client.py", line 766, in
_auth
raise saved_exception
File "C:\Users\maiya\AppData\Roaming\Python\Python310\site-packages\paramiko\client.py", line 753, in
_auth
self._transport.auth_password(username, password)
File "C:\Users\maiya\AppData\Roaming\Python\Python310\site-packages\paramiko\transport.py", line 1564, in auth_password
return self.auth_handler.wait_for_response(my_event)
File "C:\Users\maiya\AppData\Roaming\Python\Python310\site-packages\paramiko\auth_handler.py", line 245, in wait_for_response
raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.
PS C:\Users\maiya\test>
Any suggestion would really help. Thanks a lotRegards,
maiya