0

host = "<IP Address>"
port = 22
username = "<some random username>"
password = "<password>"

command = "ls"

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, port, username, password)

stdin, stdout, stderr = ssh. exec_command(command)
lines = stdout.readlines()
print(lines)

That was my code to just try and connect to another system using SSH in Python (Jupyter Notebook). But I always get this error message "TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond".

My intention is to connect to another machine and extract some files from the machine (trying to create a data pipeline). But I'm unsure as to how to get past this error.

  • Maybe does this help: [Python requests raises timeout error on a website that works on a browser](https://stackoverflow.com/questions/73485139/python-requests-raises-timeout-error-on-a-website-that-works-on-a-browser/) – puncher Aug 25 '22 at 14:19
  • @puncher: Thanks for sharing. But I'm trying to connect to another machine, not a browser. Unsure if the same logic applies. – Kiran Siddeshwar Aug 25 '22 at 14:39
  • Show us Paramiko log file + Output of `ssh -vvv ` running on the *same machine* as your Python code. – Martin Prikryl Aug 26 '22 at 06:49

0 Answers0