1
1

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.

AlibabaCloudのECSでSSHのポートを変更する

Posted at

問題

AlibabaCloudでECSのインスタンスを立ててsshの設定を行った.

↓sshdの設定

# vim /etc/ssh/sshd_config
- #Port 22
+ Port 12345
# systemctl restart sshd

↓firewalldの設定

# cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/
# vim /etc/firewalld/services/ssh.xml
- <port protocol="tcp" port="22"/>
+ <port protocol="tcp" port="12345"/>
# firewall-cmd --reload

↓設定したポートでログイン

$ ssh -p 12345 -i ~/.ssh/keyname username@aaa.bbb.ccc.ddd 
ssh: connect to host aaa.bbb.ccc.ddd port 12345: Connection timed out

と出力され,ログインできなかった.

解決

クラウド未経験だったので気付くのに時間がかかったが,
ECS管理コンソールのセキュリティグループの編集でフォワーディングする.

  1. セキュリティグループの画面に移動する.
  2. イントラネット入力のタブを選択する.
  3. 22/22の項目をクローンする.
  4. プロトコルタイプをCustom TCPに変更する.
  5. ポート範囲を12345/12345に変更する.
  6. 後はお好みの設定を行う.

aa.png

1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?