简体   繁体   中英

ssh to amazon EC2 over proxy

I have some problem connecting to my amazon EC2 server over ssh over proxy.

I have my username and password for http proxy port 8080.(dont have control over proxy) Also I have my connection string which would work without proxy ssh -i key.pem root@xx.compute.amazonaws.com

1) when I am trying to connect I am getting "No route to host" error 2) I tried to use putty, configured proxy + authentication file, But then I getting this error "Unable to use this key file (OpenSSH SSH-2 private key)" Also I dont know how putty inserts my proxy config, into ssh connection string, so I could try it in terminal

Any help will be appreciated!

SOLUTION:
Here is a tutorial which works fine: http://www.mtu.net/~engstrom/ssh-proxy.php
Note: you will need to install corkscrew.
Also this configuration enables you to run rsync over proxy
example: rsync -avz -e "ssh -i key.pem" ec2-user@xx.compute.amazonaws.com:/amz /home

I was facing the same problem and this is what I used to connect, using corkscrew. My config file looks like this

Host AWS
    Hostname <Public DNS>
    Port 443
    #Write the appropriate username depending on your AMI, eg : ubuntu, ec2-user
    User ubuntu
    IdentityFile </path to key file>
    ProxyCommand /usr/bin/corkscrew 10.10.78.61 3128 %h %p

then I simply use this command to connect

ssh AWS

and it works flawlessly.

Note : You must edit your sshd_config file on the server to listen to ssh connections on port 443 (in addition to 22) and restart the ssh daemon.

Are you sure you can login as root? Try logging in as ec2-user instead.

Also, if you have assigned an elastic IP to your instance, the public DNS has probably changed. Log in to the aws console, and select your instance. Scroll down to look at the public DNS again and double check you are using the correct xx.compute.amazonaws.com addr.

Note that the solution referenced above:

SOLUTION: Here is a tutorial which works fine: http://www.mtu.net/~engstrom/ssh-proxy.php Note: you will need to install corkscrew. Also this configuration enables you to run rsync over proxy example: rsync -avz -e "ssh -i key.pem" ec2-user@xx.compute.amazonaws.com:/amz /home

worked for me but it refers to the Corkscrew HTTP Proxy at a URL that no longer exists. But it has been re-posted as below:

https://github.com/bryanpkc/corkscrew/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM