Ubuntu GDM X Screen Access

In general, I'm trying to enter keystrokes into the Ubuntu login screen from a separate shell. I have a machine (running Ubuntu 10.04) on the standard login screen, and I SSH'd into the machine too. I tried the following (from 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 

This exact same method works as soon as the machine logs in to Ubuntu, but it does not work for the login screen.

Ideally, I want to finish logging in from another shell. I use NOT automatic startup. I just want to be able to grab the correct display and perform the keystrokes required to enter.

Any help would be greatly appreciated.

Edited by:

Thanks to the tip from nm I managed to get this work:

 export DISPLAY=:0 sudo xdotool key Return 

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

Thanks again for the help.

+4
source share
1 answer

You need to establish a connection with the display. Note the -auth to the X command. This is where the power is.

Try the following:

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

You must be root to access the permissions file.

See man xauth for (a lot) for more details.

+6
source

Source: https://habr.com/ru/post/1413942/


All Articles