sshポートフォワーディング

sshポートフォワーディング

サーバ上の資源をjupyterでいじる。

## SSHポートフォワーディング
$ ssh hoge_server -L 8080:localhost:8080

# 入った後にポート指定をしてjupyter立ち上げ
$ jupyter notebook --port 8080
[I 16:20:42.864 NotebookApp] Serving notebooks from local directory: /home/username
[I 16:20:42.864 NotebookApp] 0 active kernels
[I 16:20:42.864 NotebookApp] The Jupyter Notebook is running at:
[I 16:20:42.864 NotebookApp] http://localhost:8080/?token=e3ded9e3d2bd12b9d8158fe290d9b7813bbf50f7dc334e44
[I 16:20:42.864 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 16:20:42.864 NotebookApp] No web browser found: could not locate runnable browser.
[C 16:20:42.864 NotebookApp] 
    
    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8080/?token=e3ded9e3d2bd12b9d8158fe290d9b7813bbf50f7dc334e44&token=e3ded9e3d2bd12b9d8158fe290d9b7813bbf50f7dc334e44

http://localhost:8080/にアクセス。

$ ssh -L [リモートホストのユーザ名]@[リモートホスト] [localhostポート]:[リモートホスト]:[リモートホストポート]

参考

SSHポートフォワーディングを知った話 SSH ポートフォワーディング