我需要透過 ssh 在遠端主機上運行 Firefox 進程,並且即使在 ssh 登出後也保持進程運行。我已經嘗試過這些方法 nohup firefox &,screen,disown -h 。但似乎這些只適用於沒有硬體顯示的進程。我被這個問題困擾了很久。請幫幫我!
答案1
對於firefox,最好使用隧道
ssh -D 8080 -CfN user@server
-D 標誌設定動態連接埠轉送
-C 使用壓縮
-f 將 ssh 置於背景
-N 不執行遠端指令(對隧道有用)
看人SSH欲了解詳情
然後,您將 Firefox 設定為在本機主機連接埠 8080 上使用ocks5
在首選項 -> 進階 -> 網路標籤下
若要關閉隧道,請使用
killall ssh
答案2
要透過 ssh 運行遠端 X 應用程序,並釋放運行命令的控制台:
ssh -fX user@host Xapp
其中 Xapp 是遠端 X 應用程式。如果是 Firefox,您需要選項 -no-remote
ssh -fX user@host firefox -no-remote
有關該選項的一些資訊-f
:
-f Requests ssh to go to background just before command execution.
This is useful if ssh is going to ask for passwords or
passphrases, but the user wants it in the background. This
implies -n. The recommended way to start X11 programs at a
remote site is with something like ssh -f host xterm.