LoginSignup
1
3

More than 3 years have passed since last update.

httpプロキシ下で外部サーバーにsshする[Ubuntu18.04から]

Last updated at Posted at 2020-01-10

はじめに

httpプロキシ配下にある環境から外部のサーバーにssh接続したい場面で苦労したので,備忘録の意味も兼ねて記録しておきます.
基本的にはこちらを参考としました.

手順

インストール

// sudo apt-get updateも忘れずに
sudo apt-get install squid3
sudo apt-get install connect-proxy
sudo apt-get install openssh-client

squidの設定

/etc/squid3/squid.confに以下を追記(自分の環境ではsquidでした(3がつかない)).

acl SSL_ports port 22
acl Safe_ports port 22          # ssh

ここでsquidを再起動.

// ここも自分の環境では3がつきませんでした.ここまで起動してなければstart
service squid3 restart

sshの設定

~/.ssh/configを以下のように編集.example.comの部分を対応させて下さい.

Host example.com
        Hostname example.com
        ProxyCommand connect-proxy -H <httpプロキシのurl>:<httpプロキシのport> %h %p

実行

いつも通りにssh.

ssh user@example.com

以上

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3