Last active
September 25, 2020 10:22
-
-
Save koki-h/b7f7420d259e1bd2bd19bbd3d931a4b5 to your computer and use it in GitHub Desktop.
sshトンネリングいろいろ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #リモートホスト(serversman.gohannnotomo.org)の8081にアクセスが有った時にローカルホストの8081が応答するようなssh。 | |
| # 8081はmotionのストリーミングを想定 | |
| #ローカルホストから実行する | |
| ssh -N serversman.gohannnotomo.org -R 8081:localhost:8081 | |
| # 8081がhttpで喋っている場合、リモートホストから更に外部に公開したい場合はリモートホストのhttpd.confに追記 | |
| ProxyPass /motion http://localhost:8081 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #リモートホスト(serversman.gohannnotomo.org)からローカルホストへsshできるようにする | |
| ssh -N serversman.gohannnotomo.org -R 2222:localhost:22 | |
| #リモートからは以下のようにするローカルへssh接続できる | |
| # ssh pi@localhost -p 2222 |
Author
Author
autosshをバックグラウンドで起動し、プロセスIDを取得する
#autossh起動ユーザが/run/lock/motion_for_mukoyama/の所有者である必要がある。
$ AUTOSSH_PIDFILE=/run/lock/motion_for_mukoyama/autossh
$ nohup autossh -N -R 10022:localhost:22 serversman.gohannnotomo.org &
$ cat /run/lock/motion_for_mukoyama/autossh
2040
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#autosshを使用する場合(ローカルの22番をリモートの10022版に繋げる。-pはリモートのsshポートを指定する)
autossh -f -C -N -R 10022:localhost:22 -p 22 user@example.com
#rc.localから起動するとうまくいかないみたい。→rootユーザの設定不足だったらしい(authorized_keys)。