xdotool doesn't work via SSH
Asked Answered
Y

3

12

I want to use xdotool via SSH but get the following error:

Error: Can't open display: (default)

I found this solution:

export DISPLAY='0:0'

Still get nearly the same error :(. I also tried:

export DISPLAY=:0; or: export DISPLAY="0:0", ...

Always a error like that:

Error: Can't open display: (0:0)

Is thera a alternative (working) solution for xdotool?

I don' know whether It work lokal. I've only got a SSH-connection.

Ynez answered 28/6, 2014 at 6:33 Comment(1)
How is SSH involved here? Are you trying to use SSH's X forwarding feature? How did you run ssh to log into the server where you're trying to run xdotool?Wheaton
C
10
export DISPLAY=:0.0 && xdotool key a

Try this =)

Carbajal answered 10/11, 2014 at 10:24 Comment(0)
V
5

You did the right thing export DISPLAY='0:0'
But you should also set XAUTHORITY like this:
export XAUTHORITY="/home/username/.Xauthority"

Ofcourse the username is an account which has logged in via gnome.

Don't forget to change username with your right account name.

Vanderhoek answered 13/3, 2016 at 14:31 Comment(1)
This answer worked. Perhaps you could mark it as accepted.Masquer
I
-2

I have found a useful link for this problem please refer the below post Accessing the X Display for Ubuntu GDM login screen

It says

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

try with

export XAUTHORITY=/var/run/gdm/auth-for-gdm-[whatever-it-is]/database

Hope it helps

Inspector answered 31/12, 2015 at 8:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.