访问 X Display for Ubuntu GDM 登录屏幕 [英] Accessing the X Display for Ubuntu GDM login screen

查看:31
本文介绍了访问 X Display for Ubuntu GDM 登录屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

总的来说,我试图从一个单独的 shell 将按键注入 Ubuntu 登录屏幕.我在标准登录屏幕上有机器(运行 Ubuntu 10.04),我也通过 SSH 进入机器.我已经尝试了以下(来自 SSH shell):

Overall I am trying to inject key presses into the Ubuntu login screen from a separate shell. I have the machine (running Ubuntu 10.04) at the standard login screen and I am SSH'd into the machine as well. I've tried the following (from the SSH shell):

$ ps ax | grep X
 2844 tty8     Ss+    0:01 /usr/bin/X :0 -br -verbose -auth /var/run/gdm/auth-for-gdm-Gp2Rlq/database
$ export DISPLAY=:0
$ xdotool key Return
No protocol specified
Error: Can't open display: :0
Failed creating new xdo instance

这个完全相同的方法在机器登录到 Ubuntu 后有效,但不适用于登录屏幕.

This exact same method works once the machine is logged into Ubuntu, but it does not work for the login screen.

理想情况下,我希望能够从另一个 shell 完成登录.我不想想使用自动登录.我只想能够抓取正确的显示,并执行登录所需的按键.

Ideally, I want to be able to finish the login from another shell. I do NOT want to use automatic login. I just want to be able to grab the correct display, and execute the key presses necessary to login.

任何帮助将不胜感激.

感谢来自 n.m. 的提示.我能够使用它:

Thanks to the tip from n.m. I was able to get this working with:

export DISPLAY=:0
sudo xdotool key Return

这完成了我想要的,但现在我想知道是否有办法在没有 'sudo' 的情况下完成此任务?有没有我可以启用/禁用的标志来解决这个问题?

This accomplishes what I wanted, but now I am wondering if there is a way to accomplish this without 'sudo'? Is there a flag I can enable/disable to get around this?

再次感谢您的帮助.

推荐答案

您需要授权才能连接到显示器.请注意 X 命令的 -auth 参数.这就是权威所在.

You need authority to connect to the display. Note the -auth parameter to the X command. That's where the authority is.

试试这个:

export XAUTHORITY=/var/run/gdm/auth-for-gdm-<whatever-it-is>/database 
export DISPLAY=:0 
xdotool key Return

您需要是 root 用户才能访问权限文件.

You need to be root to be able to access the authority file.

请参阅 man xauth 以获取(更多)更多信息.

See man xauth for (a lot) more information.

这篇关于访问 X Display for Ubuntu GDM 登录屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆