在我的设备A上,我使用dwm运行x11。我想从设备B中将ssh输入到设备A中,并获得我关注于设备A的窗口的xprop输出。当我在设备a上的终端时,在终端模拟器中执行xprop -id "$(xdotool getactivewindow)",得到终端仿真器的xprop输出。然而,当我通过ssh执行这个命令时,我得到了这个输出:
Error: DISPLAY environment variable is empty. Is there an Xorg or other X server running? You can try setting 'export DISPLAY=:0' and trying again.
Failed creating new xdo instance.
xprop: unable to open display ''当我执行export DISPLAY=:0 (:0是在设备A上的终端模拟器中检查它时,它的值是$DISPLAY的值),上面的命令会产生以下错误:
Authorization required, but no authorization protocol specified
Failed creating new xdo instance.
Authorization required, but no authorization protocol specified
xprop: unable to open display ':0'如何解决这个问题(指定授权协议或任何必要的内容)?
发布于 2021-11-28 17:31:30
这取决于您的发行版如何进行X授权,而且我不熟悉dwm。一种方法是在~/.Xauthority中存储"MIT魔术曲奇“。您可以使用xauth修改它,请参阅man xauth。
如果您执行类似ps axu | grep X的操作,您将看到X服务器的命令行,在我的发行版中,这包括一个选项-auth /name/to/authfile。我可以直接将这个文件复制到~/.Xauthority (这需要读取权限,例如vs sudo),因此我可以授权其他用户或ssh连接。
这可能对你的发行版起作用,也可能不起作用。
(您还将得到执行xhost +的建议,这比获得正确的cookie更不安全)。
https://unix.stackexchange.com/questions/679428
复制相似问题