[cs615asa] Question about ssh in python

Paul-Anthony Dudzinski pdudzins at stevens.edu
Sun Mar 30 23:44:14 EDT 2014


Can you connect via ssh BEFORE you pass that command programattically? If
that is the case you might have a problem with the filepath expansion of
"~", otherwise if this only works after you may just not be able to connect
yet.


On Sun, Mar 30, 2014 at 11:32 PM, Dainong Ma <dma2 at stevens.edu> wrote:

>
> Hello everyone, I have a problem using python to connect ec2-instance.
> I write this in python so that I can connect to ec2-instance but I get a
> connection refused. I can be sure that I use correct KeyPair and
> SecurityGroup. And also I let my program time.sleep(45)
> after creating instance.
>
>            command ="ssh -i %s -o StrictHostKeyChecking=no %s@%s"%(KEYPAIR_LOCATION,
> INSTANCE_LOGIN_USR, EC2_HOST)
> output: mountvolume (65280, 'ssh: connect to host
> ec2-54-208-77-230.compute-1.amazonaws.com port 22: Connection refused\r')
>
> But when I ssh from command line right after that moment:  ssh -i
> ~/.ssh/ec2backup-keypair.pem -o StrictHostKeyChecking=no
> ec2-user at ec2-54-208-77-230.compute-1.amazonaws.com, I can connect it.
>
> Does that mean I can not write ssh command in python like that?
>
> _______________________________________________
> cs615asa mailing list
> cs615asa at lists.stevens.edu
> https://lists.stevens.edu/mailman/listinfo/cs615asa
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.stevens.edu/mailman/private/cs615asa/attachments/20140330/12512d6a/attachment.html>


More information about the cs615asa mailing list