Issue
In my company we use terminal server and we have the IDE (PhpStorm) in a remote machine. I want to use Xdebug with the web and apps that we are developing but every time I want to use it I have to open Putty and create a tunnel with the next parameters.
After that I login myself with the credentials and everything it's ready to use Xdebug. If I run a file I get this.
I want to do the same from the SSH terminal in PhpStorm. I can connect to the terminal but if I try to use the command to forward the ports I get errors all the time. I show you some of them. Sorry for the indentation, I don't know how to fix it. I try to use the port 220 because I think it is the one for this server.
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-p port]
[-Q cipher | cipher-auth | mac | kex | key]
[-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] [user@]hostname [command]
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 10.77.82.11
ssh: connect to host 10.77.82.11 port 22: Connection refused
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 ^C
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 http://10.77.82.11
ssh: Could not resolve hostname http://10.77.82.11: Name or service not known
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 10.77.82.11
ssh: connect to host 10.77.82.11 port 22: Connection refused
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 localhost
ssh: connect to host localhost port 22: Connection refused
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 10.77.82.11
ssh: connect to host 10.77.82.11 port 22: Connection refused
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 10.77.82.11
ssh: connect to host 10.77.82.11 port 22: Connection refused
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 10.77.82.11:220
ssh: Could not resolve hostname 10.77.82.11:220: Name or service not known
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 10.77.82.11
ssh: connect to host 10.77.82.11 port 22: Connection refused
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 http://10.77.82.11
ssh: Could not resolve hostname http://10.77.82.11: Name or service not known
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-p port]
[-Q cipher | cipher-auth | mac | kex | key]
[-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] [user@]hostname [command]
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 10.77.82.11
ssh: connect to host 10.77.82.11 port 22: Connection refused
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 10.77.82.11:220
ssh: Could not resolve hostname 10.77.82.11:220: Name or service not known
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 10.77.82.11
ssh: connect to host 10.77.82.11 port 22: Connection refused
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 localhost
ssh: connect to host localhost port 22: Connection refused
dirsorpor3@da01:~$ ssh -R 9000:10.77.82.31:9000 10.77.82.11
ssh: connect to host 10.77.82.11 port 22: Connection refused
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 10.77.82.31
ssh: connect to host 10.77.82.31 port 22: Connection refused
dirsorpor3@da01:~$ ssh -R 9000:localhost:9000 10.77.82.31:220
ssh: Could not resolve hostname 10.77.82.31:220: Name or service not known
Solution
You are trying to create a tunnel being logged onto the server via ssh
already, that would not work.
You need to start ssh
from the Windows machine, not from the server.
ssh -R 9000:localhost:9000 [email protected] -p 220
Answered By - Eugene Morozov