Paramiko 中的远程端口转发
Remote port forwarding in Paramiko
我试过翻译命令
ssh -R 80:localhost:8080 nokey@localhost.run
(它正常工作,问题不在服务器中)
在 https://github.com/paramiko/paramiko/blob/master/demos/rforward.py
的帮助下到 Paramiko
我的代码:
import paramiko
from rforward import reverse_forward_tunnel
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(username="nokey", hostname="localhost.run")
transport = ssh.get_transport()
reverse_forward_tunnel(8080, "localhost.run", 80, transport)
但它失败了:
Traceback (most recent call last): ...
raise SSHException("TCP forwarding request denied") paramiko.ssh_exception.SSHException: TCP forwarding request denied
求助
-R 80:localhost:8080
将远程端口 80
转发到本地 localhost:8080
。
imo 映射到 reverse_forward_tunnel
为
reverse_forward_tunnel(80, "localhost", 8080, transport)
基本上,参数顺序相同(和 localhost
,而不是 localhost.run
)。
我试过翻译命令
ssh -R 80:localhost:8080 nokey@localhost.run
(它正常工作,问题不在服务器中)
在 https://github.com/paramiko/paramiko/blob/master/demos/rforward.py
我的代码:
import paramiko
from rforward import reverse_forward_tunnel
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(username="nokey", hostname="localhost.run")
transport = ssh.get_transport()
reverse_forward_tunnel(8080, "localhost.run", 80, transport)
但它失败了:
Traceback (most recent call last): ...
raise SSHException("TCP forwarding request denied") paramiko.ssh_exception.SSHException: TCP forwarding request denied
求助
-R 80:localhost:8080
将远程端口 80
转发到本地 localhost:8080
。
imo 映射到 reverse_forward_tunnel
为
reverse_forward_tunnel(80, "localhost", 8080, transport)
基本上,参数顺序相同(和 localhost
,而不是 localhost.run
)。