2

Im writing a script for automatic connection and command execution via internet. I want to connect to my raspberry using this script:

def establish_connection(cmd=" ssh pi@00.0.000.000", *args):
   passphrase = "my_passphrase "
   proc = subprocess.popen(cmd , stdout=subprocess.PIPE,stdin=subprocess.PIPE, shell=True)

   # at this point "Enter passphrase for key 'C:\Users\.../id_rsa':" pops out in the therminal and im not able 
   # to pass that passphrase 

I have tried many things but couldn't find the right answer that would work on Windows

HAL 9000
  • 23
  • 4
  • One solution is to make yourself an SSH key that doesn't require a passphrase. Another is to set up an SSH-Agent that the ssh command will access to get credentials (you probably need to type in your passphrase once, to the agent, but not later on). – Blckknght Apr 01 '21 at 19:17
  • Sorry, I have no access to Windows machine yet, but have you tried solutions from this question? It's quite similar: https://stackoverflow.com/questions/8475290/how-do-i-write-to-a-python-subprocess-stdin – STerliakov Apr 01 '21 at 19:25
  • Yes, and it seems like SSH doesn't want to communicate PS: and yes, I thought about setting a key without passphrase, but at this point i just need to find that damn solution – HAL 9000 Apr 01 '21 at 19:31

0 Answers0