On my device A, i'm running x11 with dwm. I want to ssh into device A from device B and get the xprop output for the window i've focused on the device A. When I'm in the terminal on device a in dwm, execute xprop -id "$(xdotool getactivewindow)" in my terminal emulator, I get the xprop output of my terminal emulator. However, when I execute this command via ssh i get this output:

Error: DISPLAY environment variable is empty. Is there an Xorg or other X server running? You can try setting 'export DISPLAY=:0' and trying again.
Failed creating new xdo instance.
xprop:  unable to open display ''

When i do export DISPLAY=:0 (:0 is the value of $DISPLAY when i check it in the terminal emulator on device A), the above command produces the fowllowing error:

Authorization required, but no authorization protocol specified
Failed creating new xdo instance.
Authorization required, but no authorization protocol specified
xprop:  unable to open display ':0'

How do i fix this (specify an authorization protocol or whatever is neccessary)?

1 Answer 1


It depends on how your distro does X authorization, and I am not familiar with dwm. One way is to store a "MIT magic cookie" in ~/.Xauthority. You can modify it with xauth, see man xauth.

If you do something like ps axu | grep X, you will see the commandline of the X server, and on my distro, this includes an option -auth /name/to/authfile. I can copy this file directly to ~/.Xauthority (that requires read permissions e.g. vs sudo), and I can thus authorize other users or ssh connections.

This may or may not work on your distro.

(You'll also get the advice to do xhost +, this is more insecure than to get a correct cookie).

  • If you didn’t have xauth before you were logging in with dwm, there’s no way it was using it in your dwm session.
    – jsbillings
    Nov 29, 2021 at 0:24
  • this worked after rebooting on both machines.
    – laalsaas
    Dec 4, 2021 at 15:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .