ローカルサーバーに外部からSSHで接続させる。

何が正解なのだろう?といろいろ試している。
とりあえず下記で動いたので下記でやることにする。
本当は固定のサブドメインを割り当ててやりたかったがエラーがでる。

ポートを固定サブドメインを使って接続

C:\Users\scren>ssh -p 2222 -R 43169:localhost:22 screny@ai11.ex-pa.pro
The authenticity of host '[ai11.ex-pa.pro]:2222 ([35.202.165.19]:2222)' can't be established.
ED25519 key fingerprint is SHA256:JhoNBPFEAsdOSZjED0L23xjR5ONABrTHf08rBxDzep8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[ai11.ex-pa.pro]:2222' (ED25519) to the list of known hosts.
Press Ctrl-C to close the session.

Starting SSH Forwarding service for tcp:43169. Forwarded connections can be accessed via the following methods:
TCP: ex-pa.pro:43169

Accepted connection from 159.192.33.231:55669 -> 10.128.0.7:43169
Accepted connection from 159.192.33.231:55676 -> 10.128.0.7:43169
C:\Users\scren>ssh -p 43169  tabata@ai11.ex-pa.pro
The authenticity of host '[ai11.ex-pa.pro]:43169 ([35.202.165.19]:43169)' can't be established.
ECDSA key fingerprint is SHA256:TxcVtBJeWWAIlIl0O7UN3JU8U57LZKuuRboLyU9qiBo.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[ai11.ex-pa.pro]:43169' (ECDSA) to the list of known hosts.
tabata@ai11.ex-pa.pro's password:
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.133.1-microsoft-standard-WSL2 x86_64)

サブドメインなしで接続

C:\Users\scren>ssh -p 2222 -R 2222:localhost:22 screny@ex-pa.pro
Press Ctrl-C to close the session.

The TCP port :2222 is unavailable. Assigning a random port.
Starting SSH Forwarding service for tcp:2222. Forwarded connections can be accessed via the following methods:
TCP: ex-pa.pro:43169

Accepted connection from 159.192.33.231:55102 -> 10.128.0.7:43169
C:\Users\scren>ssh -p 43169  tabata@ex-pa.pro
The authenticity of host '[ex-pa.pro]:43169 ([35.202.165.19]:43169)' can't be established.
ECDSA key fingerprint is SHA256:TxcVtBJeWWAIlIl0O7UN3JU8U57LZKuuRboLyU9qiBo.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[ex-pa.pro]:43169,[35.202.165.19]:43169' (ECDSA) to the list of known hosts.
tabata@ex-pa.pro's password:
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.133.1-microsoft-standard-WSL2 x86_64)

Bio

田端厚賢

名前:田端厚賢(Atsuyoshi Tabata)

WordPressを中心に企業様から委託を受けてサイトやサーバーの保守・管理、システム開発を行っています。

2024年4月より東大の松尾研でLLLMの開発プロジェクトに参加しています。

プロフィール詳細
Web制作依頼の詳細
お問い合わせはコチラ