bash 如何使用其他用户的显示器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10080484/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I use another user's display
提问by geermc4
I'm using xdotool in a SSH connection logged in as root , I'm setting DISPLAY=":0.0" which is what echo $DISPLAYreturns on the logged user says. But i get a error unless i su to the other user
我在以 root 身份登录的 SSH 连接中使用 xdotool,我正在设置 DISPLAY=":0.0" 这是echo $DISPLAY登录用户返回的内容。但是我收到一个错误,除非我向其他用户发出警告
root@sb:~# export DISPLAY=":0.0"
root@sb:~# xdotool getactivewindow
No protocol specified
No protocol specified
Error: Can't open display: (null)
Segmentation fault (core dumped)
geerm@sb:~$ export DISPLAY=":0.0"
geerm@sb:~$ xdotool getactivewindow
41943046
Is ths even possible? If so, what do i need to change to use the logged in user's session ?
这甚至可能吗?如果是这样,我需要更改什么才能使用登录用户的会话?
采纳答案by zigdon
回答by pizza
Try:
尝试:
export DISPLAY=his_xserver_ip:0.0
and probably you need to add the IP allowed to connect to his xserver to his xhosts thru xhost +ip_to_connnect_from
并且可能您需要通过 xhost +ip_to_connnect_from 将允许连接到他的 xserver 的 IP 添加到他的 xhosts

