How to use ssh-agent in windows in python?

Fc Zwtyds fczwtyds at gmail.com
Sun May 26 19:56:56 EDT 2019


在 2019-05-27 0:27, MRAB 写道:
> On 2019-05-26 15:55, Fc Zwtyds wrote:
>> Hi,
>>     I am using cygwin on Windows 8.1. These two commands work fine in 
>> cygwin:
>> ssh-agent -s
>> ssh-add ~/.ssh /id_rsa
>>     I tried to use them on windows cmd and it worked fine. Now I am going
>> to use python to write code to implement the above command.
>> os.system('ssh-agent -s')
>> os.system('ssh-add id_rsa')
>> There was an error:
>> Could not open a connection to your authentication agent.
>>
>> Thank you and your time.
>>
> The string that you passed to the second os.system differs from the 
> second command on the command line. Is that the cause?

Hi,
   At the beginning string is like this
ssh-add ~/.ssh/id_rsa
   In order to facilitate the test, multiple quick input, I copied 
id_rsa into the program directory, the string was changed to
ssh-add id_rsa
   Whether in cygwin or cmd, manually entering these two commands will 
execute correctly.

As far as I know, the problem seems to be that a subshell is opened 
after 'ssh-agent -s' execution, and I don't know how to use python to 
implement this process.

Thank you for your help



More information about the Python-list mailing list