【问题标题】:Port forwarding command端口转发命令
【发布时间】:2021-08-21 23:29:30
【问题描述】:
我正在尝试使用以下命令通过 ssh 进行端口转发:
ssh -L 9540:localhost:8011 user@ipdest
该端口用于 https 流量,我在运行命令时没有收到任何错误,实际上我获得了到目标 ip 的 ssh 连接。
问题是当我尝试使用浏览器连接到 url localhost:9540 时,它没有显示任何内容,我无法访问 https 服务。
【问题讨论】:
标签:
linux
command
portforwarding
【解决方案1】:
您能否使用以下命令检查 sshd 配置文件,并确保粗体行与示例相同?
more /etc/ssh/sshd_config
#AllowAgentForwarding 是
AllowTcpForwarding 是
#GatewayPorts 否
X11转发是的
#X11DisplayOffset 10
#X11UseLocalhost 是的
#PermitTTY 是
PrintMotd 没有
#PrintLastLog 是
#TCPKeepAlive 是的
#PermitUserEnvironment 否
#压缩延迟
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
PermitTunnel 是
#ChrootDirectory 无
#VersionAddendum 无
如果不是,请按照示例设置线路并重新启动 sshd 服务,然后尝试重新连接并再次测试您的隧道。