2012-04-09 78 views
4

我在使用xdotool作爲root登錄的SSH連接,我正在設置DISPLAY =「:0.0」,這就是登錄用戶說的echo $DISPLAY返回的結果。但我得到一個錯誤,除非我su到其他用戶我怎樣才能使用另一個用戶的顯示

[email protected]:~# export DISPLAY=":0.0" 
[email protected]:~# xdotool getactivewindow 
No protocol specified 
No protocol specified 
Error: Can't open display: (null) 
Segmentation fault (core dumped) 

[email protected]:~$ export DISPLAY=":0.0" 
[email protected]:~$ xdotool getactivewindow 
41943046 

是部份甚至可能嗎?如果是這樣,我需要更改以使用登錄用戶的會話?

+0

或'Segmentation fault's,你應該在[xdotool GitHub](https://github.com/jordansissel/xdotool/issues)檢查或報告它們。 – kenorb 2015-08-01 10:03:42

回答

3

默認情況下,大多數X服務器不允許其他用戶在對方的屏幕上顯示。如果你想禁用這種保護,你可以使用xhost

1

嘗試:

export DISPLAY=his_xserver_ip:0.0 

,也許你需要如果您有任何進一步的錯誤添加IP允許連接到他的Xserver他xhosts通xhost的+ ip_to_connnect_from

http://www.xfree86.org/current/X.7.html

+0

如果它是相同的主機,只是另一個用戶該怎麼辦。 – geermc4 2012-04-10 04:40:44

+0

與同一個X服務器中的主機相同嗎?你與其他人分享同一屏幕? – pizza 2012-04-10 05:42:06

+1

我是兩個人,我試圖使用一個腳本作爲根運行,保持谷歌瀏覽器打開,如果不是,我想打開它,登錄用戶是A,腳本以root身份運行,我明白我可以sudo -u A,只是想避免它 – geermc4 2012-04-10 17:28:34