Franklin84
Franklin84

Reputation: 573

xdotool doesn't work via SSH

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.

Upvotes: 12

Views: 12473

Answers (3)

Arash
Arash

Reputation: 314

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.

Upvotes: 5

Hope
Hope

Reputation: 1

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

Upvotes: -2

funivan
funivan

Reputation: 3433

export DISPLAY=:0.0 && xdotool key a

Try this =)

Upvotes: 11

Related Questions