
我使用 ~/.ssh/config 登入internal.local
公司伺服器:
Host internal.local
ProxyCommand ssh -e none corporate.proxy nc %h %p
但是在關閉會話(輸入exit
)後,我在伺服器上的 sshd 會話仍然處於活動狀態(我透過不同的連線看到它)。
我是否可以關閉會話或以適當的方式更改配置以消除掛起會話?
首先從第二個根會話檢查:ps -fu user_name
user_name 861 855 0 16:58:16 pts/3 0:00 -bash
user_name 855 854 0 16:58:13 ? 0:00 /usr/lib/ssh/sshd
退出後:
user_name 855 854 0 16:58:13 ? 0:00 /usr/lib/ssh/sshd
就在scp
檔案傳入/傳出internal.local
新scp
會話之後,伺服器上仍然掛起。
答案1
使用
# for Solaris
ProxyCommand ssh -e none corporate.proxy nc %h %p -c
或者
# for *nix
ProxyCommand ssh -e none corporate.proxy nc %h %p -w 5
-c
在 Solaris 上完成工作後導致關閉連接,-w
在 *nix 系統上也是如此。