I am trying to use xdotool over ssh on Ubuntu 20.04 LTS. It works perfectly from within a terminal window when logged in locally, but over ssh it displays the following error from using any command:
$ xdotool click 1 Error: Can't open display: (null) Failed creating new xdo instance
Looking up this error the fix people suggest is exporting the DISPLAY variable before running it, but for me this only leads to a new line added to the error message:
$ export DISPLAY=:0.0 && xdotool click 1 No protocol specified Error: Can't open display: (null) Failed creating new xdo instance
Looking for "No protocol specified" errors for xdotool the only other suggestion I've been able to find is also adding
export XAUTHORITY=/home/[username]/.Xauthority to the command as well but that makes no difference for me. It's probably worth noting that I don't have an .Xauthority file in my home directory either (and creating an empty one just to see if it made a difference did not help). I'm not really familiar with X server stuff so I don't know if these things have changed since the results I'm finding where written.
I would appreciate any advice in trying to get this to work.
Solved: As pointed out by N0rbert I was missing the -X option when connecting over SSH. That's all I needed to include.