在Debian系统中,要通过代理服务器使用SSH,您可以使用以下方法之一:
方法1:使用环境变量
<proxy_host>和<proxy_port>为您的代理服务器地址和端口。export http_proxy="http://<proxy_host>:<proxy_port>"
export https_proxy="http://<proxy_host>:<proxy_port>"
ssh <remote_user>@<remote_host>
unset http_proxy
unset https_proxy
方法2:使用corkscrew
sudo apt-get update
sudo apt-get install corkscrew
~/.ssh/config。使用文本编辑器打开或创建文件:nano ~/.ssh/config
<proxy_host>、<proxy_port>、<remote_user>和<remote_host>为您的代理服务器地址、端口、远程服务器用户名和地址。Host <remote_host>
User <remote_user>
ProxyCommand corkscrew <proxy_host> <proxy_port> %h %p
保存并关闭文件。
现在,您可以使用SSH连接到远程服务器,代理设置将自动应用。
ssh <remote_host>
注意:这些方法适用于HTTP和HTTPS代理。如果您需要使用SOCKS代理,可以将corkscrew替换为proxychains。首先安装proxychains:
sudo apt-get update
sudo apt-get install proxychains
然后按照方法2中的步骤创建SSH配置文件,并将ProxyCommand行更改为:
ProxyCommand proxychains ssh <remote_user>@<remote_host>