[問題] X11 connection rejected
大家好,小弟今早連線學校雲端 Windows 10 的 MobaXterm 連SSH到學校實驗室Linux
伺服器(Scientific Linux),開啟我的模擬軟體時,突然出現底下的錯誤訊息:
X11 connection rejected because of wrong authentication
couldn't connect to display "localhost:10.0"
明明 MobaXterm 上方就提到
X11-forwarding 打勾
DISPLAY 打勾
後來我用自己的 MacBook air 用 SSH 指令連線,並開啟模擬軟體,也出現同樣錯誤。
ssh -l username -X IP
重要的是我昨晚凌晨兩點還可以順利開啟模擬軟體,不管是在 Win10 還是 MacOS 都可。
真的不清楚是怎麼回事了。怎麼會突然出問題呢?
-----
後來我查了 StackExchange 文章:https://reurl.cc/vn14pN
裡頭提到檢查當前 $DISPLAY 是否有在 ~/.Xauthority 中,
於是我輸入 echo $DISPLAY,得到:
localhost:10.0
然後輸入 xauth list,出現一串東西,其中看起來跟 $DISPLAY 比較相似的是:
localhost.localdomain/unix:10 MIT-MAGIC-COOKIE-1
204616784711287df21f92540e9f85ee
我不確定這是不是就是 localhost:10.0,於是我想說就當作不是吧。
就直接自己新建一個好了。
xauth add $DISPLAY - `mcookie`
結果出現
xauth: (argv):1: key contains odd number of or non-hex characters
重新輸入 xauth list,發現內容好像沒什麼變化....
---
後來我看到另一篇文章"xauth not creating .Xauthority file"
https://superuser.com/questions/806637/xauth-not-creating-xauthority-file
我想起如果把 ~/.Xauthority 移除,那照理說如果我輸入需要X11的指令,例如
xclock,那麼系統應該會自己建立 ~/.Xauthority?於是我輸入
mv .Xauthority old.Xauthority
然後再登出、登入並輸入 xclock,發現還是出現問題....
X11 connection rejected because of wrong authentication.
Error: Can't open display: localhost:10.0
並且在 /home/username 目錄中,系統並沒有自動生成 .Xauthority,覺得很奇怪。
----- 相關資訊補充 -----
另外我的 ~/.Xauthority 確實是在 /home/username 底下,其權限為600。
至於目錄本身則是 700。
也有輸入 yum install xorg-x11-xauth,說是最新版本不需更新
Package 1:xorg-x11-xauth-1.0.9-1.el7.x86_64 already installed and
latest version
Nothing to do
我也有確認 SSH 伺服器之 X Forwarding 設定
$ cat /etc/ssh/sshd_config | grep X11Forwarding
X11Forwarding yes(確實是yes)
我也有確認 SSH 客戶端(MacOS)之 X Forwarding 設定
$ cat /etc/ssh/ssh_config | grep ForwardX11
ForwardX11 yes
ForwardX11Trusted yes
輸入ssh -v -X user@host,出現
ssh: Could not resolve hostname username: nodename nor servname
provided, or not known
我也有在 sshd_config 中添加 AddressFamily inet 强制 OpenSSH 只使用 IPv4
究竟該怎麼辦才好呢 QQ 這樣下去我不知道怎麼做研究了 QAQ..
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.192.0.245 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1568344079.A.B5D.html
→
09/13 12:07,
6年前
, 1F
09/13 12:07, 1F
感謝大大!我來試試看,我還以為能成功ssh連線就是ok@@
回報結果:
64 bytes from host: icmp_seq=8 ttl=52 time=13.246 ms
有哦,上次真是感謝您
※ 編輯: Philethan (123.192.0.245 臺灣), 09/13/2019 12:19:27
推
09/13 12:21,
6年前
, 2F
09/13 12:21, 2F
→
09/13 22:40,
6年前
, 3F
09/13 22:40, 3F
推
09/15 13:47,
6年前
, 4F
09/15 13:47, 4F
後來我請 bamchisu 大大幫我重灌了 XD
當時是連 xinit、startx 都有 fatal error ... 感謝您!
懷疑是跟 Teamviewer 有關,但當時我們移除 Teamviewer 後,也沒解決問題QQ
※ 編輯: Philethan (123.192.0.245 臺灣), 09/16/2019 22:20:02