7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS 踏み台ホスト:クイックスタートリファレンスデプロイ 多段SSHでハマる

Last updated at Posted at 2017-12-21

前提

AWS クラウドでの Linux 踏み台ホスト

AWSは、よくある踏み台ホスト環境の CloudFormation テンプレートを用意しています。
AWS クラウドでの Linux 踏み台ホスト: クイックスタートリファレンスデプロイ

多段SSHでハマる

多段SSH 設定例

~/.ssh/config
Host bastion #踏み台
   HostName xxx.xxx.xxx.xxx #グローバルIP
   Port 22
   User xxxxxx
   IdentityFile ~/.ssh/id_rsa

Host target #各サーバ
   HostName 10.0.0.1 #VPC内ローカルIP
   User xxxxxx
   IdentityFile ~/.ssh/id_rsa
   ProxyCommand ssh -W %h:%p username@xxx.xxx.xxx.xxx

多段SSH 実行時のエラーメッセージ

$ ssh target
channel 0: open failed: administratively prohibited: open failed
stdio forwarding failed
ssh_exchange_identification: Connection closed by remote host

最初焦りましたが、理由は単純で AWS提供のbastionサーバのデフォルトがAllowTcpForwarding no でした。

設定を変更して

/etc/ssh/sshd_config
AllowTcpForwarding yes

sshを再起動しましょう

service sshd restart
7
4
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
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?