SSH config on Windows when working under a HTTP proxy - windows

I'm trying to set up my ~/.ssh/config file to connect on servers through the HTTP proxy my company is using, but it's falling everytime...
Does anyone know how to do this ?
I'm working on Windows 7, using the Git Bash tool, and here is my current ~/.ssh/config:
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa
ProxyCommand connect -H XX.XX.XX.XXXX:8080 %h 443
The command ssh -T git#github.com -v outputs :
OpenSSH_7.1p2, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /c/Users/name/.ssh/config
debug1: /c/Users/name/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec connect -H XX.XX.XX.XXXX:8080 github.com 443
debug1: permanently_drop_suid: 1201653
debug1: identity file /c/Users/user/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/gregv/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
ssh_exchange_identification: Connection closed by remote host

OK, my problem was actually the port set on 443, here is the correct ~/.ssh/config file file that is working for me :
Host github.com
IdentityFile ~\.ssh\id_rsa
ProxyCommand connect -H XX.XX.XX.XXXX:8080 %h %p
ForwardAgent yes

Related

Unable to connect to amazon ec2 ubuntu instance via ssh using elastic ip

At first, I was able to connect using ssh.
After some time the connection got closed and since then I am not able to connect.
Below is the debug log.
what I can see is the connection is established but again broked.
I have tried rebooting, starting and stopping the server but nothing is working for me. Please help.
username:coding my.name$ ssh -i "aws_ubuntu_16.pem" ubuntu#xx.xx.xx.xx -vv
OpenSSH_7.7p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: resolve_canonicalize: hostname xx.xx.xx.xx is address
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to xx.xx.xx.xx [xx.xx.xx.xx] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file aws_ubuntu_16.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file aws_ubuntu_16.pem-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.7
ssh_exchange_identification: read: Connection reset by peer
Approach 1: The most likely to be possible reason for this issue is
that your IP must have been blacklisted. Could you please check if
your Elastic IP is blacklisted. If yes, whitelist it and try to ssh
again. You can use 'spamhaus.org' for checking the blacklisted
IP and whitelisting it again.
Approach 2: Not recommended, but you can try changing the Elastic IP
if the issue still persists.

SSH in git behind proxy on windows - FATAL: Connection closed by peer

By a SSH connection, I'm trying to clone a Repository from a Company BitBucket which use 7999 port (not Bitbucket.org) using Git Bash. I've generated the RSA key and added the public key into my profile of the BitBucket Company and the keys re located in ~/.ssh, I've setup the proxy by using git config --global http.proxy http://userPrx:pwdPrx#ipProx:8080 (because I'm under the Company Proxy) and also I have setup my config file as this post suggest. Then, when I try to Test the connection I get this:
$ ssh -vT globaldevtools -p 7999
OpenSSH_7.3p1, OpenSSL 1.0.2j 26 Sep 2016
debug1: Reading configuration data /c/Users/MyUser/.ssh/config
debug1: /c/Users/MyUser/.ssh/config line 5: Applying options for globaldevtools
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: Executing proxy command: exec /C/Users/MyUser/AppData/Local/Programs/Git/mingw64/bin/connect.exe -S IpProxy:8080 x.x.x.x 7999
debug1: permanently_drop_suid: 1104711
debug1: identity file /c/Users/MyUser/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyUser/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
FATAL: Connection closed by peer.
ssh_exchange_identification: Connection closed by remote host
This is my config file:
ProxyCommand /C/Users/MyUser/AppData/Local/Programs/Git/mingw64/bin/connect.exe -S IpProxy:8080 %h %p
Host globaldevtools
User git
Port 7999
Hostname x.x.x.x
IdentityFile ~/.ssh/id_rsa
TCPKeepAlive yes
IdentitiesOnly yes
I must indicate that in this file (config) instead of IpProxy:8080 I've tried with
http://IpProxy:8080
http://usrProx:pwdProx#IpProxy:8080
usrProx:pwdProx#IpProxy:8080
Do I have to do something else? Did I miss something? All help is appreciated.

SSH error: ssh_exchange_identification: Connection closed by remote host

I have a website hosted on a remote, shared server. I am on Windows and am trying to SSH in to my host from the Git Bash command line. I've created a new RSA key of size 4096 via cPanel and authorized it. I downloaded the public and private keys and added the key to my ssh config file:
IdentityFile ~/.ssh/mykey_rsa
When I issue the command ssh -vvv user#something.com I get an error.
OpenSSH_7.1p2, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /c/Users/Me/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to something.com [174.37.199.18] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Me/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Me/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/Me/.ssh/acquia_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Me/.ssh/acquia_rsa-cert type -1
debug1: identity file /c/Users/Me/.ssh/mykey_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Me/.ssh/mykey_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
ssh_exchange_identification: Connection closed by remote host
How do I troubleshoot this? What's more, how do I do so on Windows, without a full complement of Unix-based command-line tools? Basically the tools I have are Git Bash, the Windows command line, cPanel, and I can FTP into my server with Filezilla or from the Windows command line.

Connecting to Bitbucket using ssh through proxy

I have run out of options. I have tried several methods but none have worked so I hope someone can help me.
At work we operate behind a proxy; at the moment I am setting a repository that I would like to pull from and push from. I want to this using ssh so I don't need the password at work or when I take the laptop at home.
The repository is created.
I have created an additional distinct ssh key and added it in bitbucket setting profile.
I have loaded the ssh key using the following command - ssh-add ~/.ssh/personal
I have checked and the key is loaded.
when I try to connect to my repository,using clone or any other action(push or pull),it doesn't work
operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have also tried to create a config file in .ssh/ with the following values
Host personalid
HostName bitbucket.org
IdentityFile ~/.ssh/personal
but still it doesn't work
I don't know whether is a proxy issue or something else, I thought ssh should allow me to bypass everything.
Can someone give me an idea on how to diagnose the problem?
Thank you
=========
UPDATE: result of the command ssh -Tv hg#bitbucket.org
ssh -Tv hg#bitbucket.org
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/username/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to bitbucket.org [131.103.20.167] port 22.
debug1: connect to address 131.103.20.167 port 22: Operation timed out
debug1: Connecting to bitbucket.org [131.103.20.168] port 22.
debug1: connect to address 131.103.20.168 port 22: Operation timed out
ssh: connect to host bitbucket.org port 22: Operation timed out
=========
If i use port 443
ssh -Tv -p 443 hg#bitbucket.org
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/username/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to bitbucket.org [131.103.20.167] port 443.
debug1: connect to address 131.103.20.167 port 443: Operation timed out
debug1: Connecting to bitbucket.org [131.103.20.168] port 443.
debug1: connect to address 131.103.20.168 port 443: Operation timed out
ssh: connect to host bitbucket.org port 443: Operation timed out
when trying ssh -Tvp443 hg#altssh.bitbucket.or
ssh -Tvp443 hg#altssh.bitbucket.org
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/username/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to altssh.bitbucket.org [131.103.20.174] port 443.
debug1: connect to address 131.103.20.174 port 443: Operation timed out
ssh: connect to host altssh.bitbucket.org port 443: Operation timed out
The best diagnosis would be to fake an SSH session:
ssh -Tv hg#bitbucket.org
(It doesn't matter whether you're using Git or Mercurial; this test does the same thing either way.)
There'll be a wall of output from the command, thanks to the -v, but the first thing to look for would be a line like this at the end with your specific username:
logged in as cpu2007.
That will establish that a) you're reaching Bitbucket and b) your key is added to your account. If you don't see a line like that, then that should help you diagnose your problem.

Connection reset by peer error using cygwin on windows to connect minix via ssh

i'm using minix on my virtualbox, I was able to connect to minix using putty yesterday, but today everything seems to fail. After this failing I tried to uninstall all the openssh and its etc/ssh directory and reinstall, tried other network adapters, tried using cygwin, and using pscp. But I simply can't connect to minix anymore. Any help would be appreciated.
I'm now using this command on cygwin:
$ ssh -p 3022 -v -v -v root#localhost
and the output is:
OpenSSH_6.3, OpenSSL 1.0.1e 11 Feb 2013
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [::1] port 3022.
debug1: connect to address ::1 port 3022: Connection refused
debug1: Connecting to localhost [127.0.0.1] port 3022.
debug1: Connection established.
debug1: identity file /home/Cem/.ssh/id_rsa type -1
debug1: identity file /home/Cem/.ssh/id_rsa-cert type -1
debug1: identity file /home/Cem/.ssh/id_dsa type -1
debug1: identity file /home/Cem/.ssh/id_dsa-cert type -1
debug1: identity file /home/Cem/.ssh/id_ecdsa type -1
debug1: identity file /home/Cem/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.3
ssh_exchange_identification: read: Connection reset by peer
You have to allow connections within your own subnet in the Cygwin /etc/hosts.allow. Add a line like this to your /etc/hosts.allow on the Cygwin machine:
ALL : 192.168.123.0/24 : allow
and in your case, you'll need to add the localhost like so:
ALL : localhost 127.0.0.1/32 [::1]/128 [::ffff:127.0.0.1]/128 : allow
The last line should have come with a stock Cygwin installation so it would be strange if you had to add it.
It matters where you enter it. You will have some DENY entries and you should put it above those, but it should work if you put it with all of the other ALLOW statements.

Resources