"Can't open display" with xrandr when I run it over SSH, happening on Ubuntu20.04

I would like to control display configuration of my Ubuntu20.04 through SSH. Windows machine issues the command via SSH, Ubuntu will execute it. It worked with Ubuntu 18.04, but it doesn't after I upgraded it to 20.04.

What I did with 18.04 was like this.

ssh <user>@<Ubuntu IP> bash -c 'export DISPLAY=:1; xrandr --auto && xrandr --output HDMI-0 --off'

But it doesn't work with 20.04, I get "Can't open display" error. Tried DISPLAY=:0 but it didn't help. Can anybody help?

Regards,

2 Answers

xrandr -display :0.0 work well in uart cmd line

You can use -display :0.0 option for controling display configuration through SSH.

e.g. set brightness via SSH :

xrandr -display :0.0 --output HDMI-0 --brightness 0.2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like