2025/2/5

ssh connect with X forward in Windows Command console

ref: 首先Windows 要 Run Xserver,一般用 Xming 或是 XcXsrv。
然後在 Windows Command Console 要設定環境變數 DISPLAY
set DISPLAY=127.0.0.1:0.0
實際上後面的意思是
127.0.0.1:display_number.0.
雖然我也不知道 XLauncher 的 display number 是哪個...
可以在windows status bar 上把游標移到 X server 的地方停一下,會顯示 0.0.

然後就可以用 ssh -Y 連線了,因為 Windows 的 ssh client 沒有 -X 選項.
-Y 是 untrust X forward.
-X 是 trusrt X forward.


一定要設完環境變數再連 ssh,不然 ssh 不會設定好連線後, linux 端的環境變數。



要啟動 gnome-terminal的話,ref:Getting gnome-terminal via SSH and Xming,藥用
dbus-launch gnome-terminal



remote X 時,用 python 的 matplotlib.pyplot.show( ) 常常出現問題,
例如會說
libEGL warning: DRI3: failed to query the version
libEGL warning: DRI2: failed to authenticate
libEGL warning: DRI3: failed to query the version
有說明說,在 import matplotlib 後,加上:
matplotlib.use('TkAgg')
就可以。


2026/03/30

又變得不一樣。( 還是因為powershell ssh 的關係?)
Windows 10, ubuntu 24.04, server 和 Desktop 都是這樣
  • XcVsrc 或 Xming 都要勾選 ''Disable access control''
  • ssh -X/Y 後,要export DISPLAY=(windows IP):0.0

沒有留言:

張貼留言