I am using PUTTY and VNCSERVER/VNC Viewer to use XWINDOWS to use UNIX software remotely on a Windows Machine.

  1. I use PUTTY to SSH into my server.
  2. I started VNCSERVER in UNIX
  3. I not port it tells me
  4. I start VNC Viewer with hostname:thatport.

I start the software in UNIX and I get a "Display environment variable not defined error"

How do I fix this ?

Thank you.

2 Answers 2


First of all you should check the vncsever is running with

$ps fax

Then you must check the listening 5900 port with

$netstat -ntpl

If the Unix server on the same LAN, just use vncviewer to the port. Openssh let you tunnel ports in case is not in the same LAN (The same command should be done with putty)

$ ssh -L5900:localhost:5900 remotehost

The just vncviewer to localhost


GUI software requires the $DISPLAY env variable configured. I think you need to start that software in your vncviewer session, instead of the SSH/putty session, or at least set the $DISPLAY variable properly in your ssh/putty session.

  • ok, how do i do this properly
    – user4434
    Commented Jun 14, 2020 at 8:05
  • @sheeple the command vncserver would usually report a display number like :5, rather than a port number (although the two are related by default by port # = display # + 5900). You should be able to start a GUI application on the VNC display from the PuTTY session using a command like DISPLAY=:5 somecommand or export DISPLAY=:5; somecommand. You may want to disown the process after so that it doesn't die if the SSH connection is lost. Commented Jun 14, 2020 at 13:26
  • right, that's the approach I'd suggest too
    – Alan Cheng
    Commented Jun 16, 2020 at 7:27

You must log in to answer this question.

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