autossh 開機自動 - Linux

Table of Contents

※ 引述《yshihyu (yshihyu)》之銘言:
: 我家裡電腦在 ~/.profile 底下加上下面指令可以成功建起 tunnel
: nohup autossh -M 23456 -NfR 8888:localhost:22 [email protected] &
: 帶是在公司一樣的ubuntu 16.04 下無法成功建立 tunnel
: 後來我用 ps aux | grep '8888' 發現家裡的會有下面兩行
: 2425 0.0 0.0 6424 88 ? Ss 18:52 0:00
: /usr/lib/autossh/autossh -M 23456 -NR 8888:localhost:22
: [email protected]
: 2426 0.0 0.0 46968 5148 ? S 18:52 0:00 /usr/bin/ssh
: -L 23456:127.0.0.1:23456 -R 23456:127.0.0.1:23457 -NR 8888:localhost:22
: [email protected]
: 可是公司電腦不會出現下面這行
: /usr/bin/ssh
: -L 23456:127.0.0.1:23456 -R 23456:127.0.0.1:23457 -NR 8888:localhost:22
: [email protected]
: 但是我手動下 nohup autossh -M 23456 -NfR 8888:localhost:22 [email protected] &
: 兩行又有出現可以正常建起 tunnel
: 請問這問題可能是什麼原因?
: 謝謝
-----------------------------------------------------------------------------

我目前發現怪現狀是有時候可以成功 Connection established
就是 Connection refused失敗後再多試幾次連線 command
ssh -vvv shihyu@localhost -p 7777
又可以成功 Connection established

請問這可能是什麼原因

下面是Connection established & Connection refused 訊息
https://gist.github.com/anonymous/3eb0f4f9d36523862684c9b0293a8bf3

謝謝

--

All Comments

Caroline avatarCaroline2017-07-16
忘了請你多設ExitOnForwardFailure,這可以避免ssh連上,
Ivy avatarIvy2017-07-20
但forwarding port卻沒開成功