CentOS6.3でsshをproxy経由で使用する方法
だいたいWin7でやったことと同じ。
Githubアカウントを作る。(省略)
SSH keypairを作りGithubへ登録。
$ ssh-keygen -t rsa -C "自分のメールアドレス"
「~/.ssh」配下に諸々の鍵が生成。GithubのSSH Keysページhttps://github.com/settings/sshからpublic key(id_rsa.pub)を登録。
接続テスト→失敗(省略)
proxy超えをするための設定
「~/.ssh」配下にconfigを作成。以下を記述する。
先に補足すると
-
- connectをどこかから入手する。
- ★proxy.example.com:port★は各々の環境に合わせて書き換える。
参考。こちらSSH through HTTP proxy
$ vim /etc/ssh/sshd_config Port 443
再起動も忘れずに
$ sudo /etc/init.d/ssh restart
connectを入手しましょう
$ wget http://www.meadowy.org/~gotoh/ssh/connect.c $ gcc connect.c -o connect $ sudo cp connect /usr/local/bin/ ; chmod +x /usr/local/bin/connect
~/.ssh/configファイルを編集する
ProxyCommand connect -H ★proxy.example.com:port★ %h %p Host github.com User git Port 22 Hostname github.com IdentityFile ~/.ssh/id_rsa TCPKeepAlive yes IdentitiesOnly yes Host ssh.github.com User git Port 443 Hostname ssh.github.com IdentityFile ~/.ssh/id_rsa TCPKeepAlive yes IdentitiesOnly yes