Ubuntu – How to change local display resolution via SSH


I have a machine running Ubuntu Server 12.04 LTS and I'm having problems with the local monitor. The Dell flat panel I'm using only displays this message while the computer running: "Cannot Display This Video Mode" and then the information: "Optimum resolution 1280×1024 60Hz". I'm fairly new to using an operating system wholly via command line but I'm learning fast. 🙂 I can access the server fine via SSH so using it is not a problem. However, for where it is positioned at the moment, it would be much more convenient to use the computer locally. I'm just wondering how to change the local screen resolution via SSH to something usable by my monitor. Thanks for your time!

BTW: I have also tried switching displays and I still have the same problem.

Also BTW: I tried putting in the xrandr command and all I get back is: Can't open display

Best Answer

In your ssh session try running

export DISPLAY=:0

prior to the xrandr call. That will let xrandr know to use the local display rather than the one you've logged in from.

So, you're going to do something like:

  $ ssh my_machine
  $ export DISPLAY=:0
  $ xrandr --output VGA1 --mode 800x600

Replace VGA1 with whatever the name of your display is, and 800x600 with whatever resolution you're trying to achieve.

Related Question