从 SSH 终端转发端口
Forwarding port from the SSH terminal
在我的公司,我们使用终端服务器,我们在远程机器上有 IDE (PhpStorm)。我想将 Xdebug 与我们正在开发的网络和应用程序一起使用,但每次我想使用它时,我都必须打开 Putty 并使用下一个参数创建一个隧道。
之后,我使用凭据和准备好使用 Xdebug 的所有内容登录自己。如果我 运行 一个文件,我会得到这个。
我想在 PhpStorm 的 SSH 终端上做同样的事情。我可以连接到终端,但如果我尝试使用命令转发端口,我总是会出错。我给你看其中的一些。抱歉缩进,我不知道如何修复它。我尝试使用端口 220,因为我认为它是该服务器的端口。
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
您正在尝试创建一个正在通过 ssh
登录到服务器的隧道,那是行不通的。
您需要从 Windows 机器而不是服务器启动 ssh
。
ssh -R 9000:localhost:9000 dirsorpor3@10.77.82.31 -p 220
在我的公司,我们使用终端服务器,我们在远程机器上有 IDE (PhpStorm)。我想将 Xdebug 与我们正在开发的网络和应用程序一起使用,但每次我想使用它时,我都必须打开 Putty 并使用下一个参数创建一个隧道。
之后,我使用凭据和准备好使用 Xdebug 的所有内容登录自己。如果我 运行 一个文件,我会得到这个。
我想在 PhpStorm 的 SSH 终端上做同样的事情。我可以连接到终端,但如果我尝试使用命令转发端口,我总是会出错。我给你看其中的一些。抱歉缩进,我不知道如何修复它。我尝试使用端口 220,因为我认为它是该服务器的端口。
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
您正在尝试创建一个正在通过 ssh
登录到服务器的隧道,那是行不通的。
您需要从 Windows 机器而不是服务器启动 ssh
。
ssh -R 9000:localhost:9000 dirsorpor3@10.77.82.31 -p 220