I have no real idea what I'm doing here so please bear that in mind if you can help me!
I am trying to connect to my virtual server through a proxy but I can't connect, it just hangs. I'm assuming this is because it's not getting through our proxy.
I have tried exactly the same thing at home and it works perfectly. I'm on OSX running using Terminal to connect.
Can anyone advise me how I can get through the proxy with SSH?
If your SSH proxy connection is going to be used often, you don't have to pass them as parameters each time. you can add the following lines to
~/.ssh/config
then to connect use
Source:
http://www.perkin.org.uk/posts/ssh-via-http-proxy-in-osx.html
Here's how to do Richard Christensen's answer as a one-liner, no file editing required (replace capitalized with your own settings, PROXYPORT is frequently 80):
You can use the same
-o ...
option for scp as well, see https://superuser.com/a/752621/39364If you get this in OS X:
it may be that you're accidentally using the homebrew version of netcat (you can see by doing a
which -a nc
command--/usr/bin/nc
should be listed first). If there are two then one workaround is to specify the full path to the nc you want, likeProxyCommand=/usr/bin/nc
...For CentOS
nc
has the same problem ofinvalid option --X
.connect-proxy
is an alternative, easy to install usingyum
and works --@rogerdpack for windows platform it is really hard to find a nc.exe with -X(http_proxy), however, I have found nc can be replaced by ncat, full example as follows:
and ncat with --proxy can do a perfect work
In my case since I had a jump host or Bastion host on the way, and because the signatures on these bastion nodes had changed since they were imported into known_hosts file, I just needed to delete those entries/lines from the following file:
From above file, delete those lines referring to the bastion hosts.
I was using the following lines in my
.ssh/config
(which can be replaced by suitable command line parameters) under UbuntuWhen using it with Msys2, after installing
gnu-netcat
, filessh-err.log
showed that option-X
does not exist.nc --help
confirmed that, and seemed to show that there is no alternative option to handle proxies.So I installed
openbsd-netcat
(pacman
removedgnu-netcat
after asking, since it conflicted withopenbsd-netcat
). On a first view, and checking the respective man pages,openbsd-netcat
and Ubuntunetcat
seem to very similar, in particular regarding options-X
and-x
. With this, I connected with no problems.