Easy way to open Linux X-Term in Windows

Using Xming & Putty can connect to remote Linux X-server from windows desktop. By this way you will be able to view remote server GUI from windows desktop. This avoids need of physical console access to server.

Because granting server console access to application or normal user is a bad idea. One of my user pressed Ctr+Alt+Del while working on VMware virtual machine console. Which made system to reboot.

Xming – Lightweight X windows tool runs in windows desktop at background. Download from here.

Putty – To establish and authenticate connection to remote server

How to establish X-Term session

  1. On remote Linux server install “X Server” packages.

#yum groupinstall “X Window System”

  1. Set loopback and host entry in /etc/hosts.     localhost  rhel4

  1. Allow X11 forwarding from both SSH client and server.

On /etc/ssh/sshd_config  set  “X11Forwarding yes”

On /etc/ssh/ssh_config set “ForwardX11Trusted yes”

That’s all from server side. Next come to windows machine.

  1. Install the “xming” utility and ensure it started. You can see the icon in notification area.
  2. Open putty terminal and enter server IP/Hostname. Then navigate to connection->ssh->X11.
  3. Check the “Enable X11 forwarding” and open connection.
  1. The authentication protocol “MIT-Magic-Cookie-1” must be chose.
  2. Open SSH session. From this terminal, you may use your X-window system such xclock, xterm. One of the great use case is GUI based application installation, configuration such Oracle Installation.

Error Fix

Are you receiving cannot open display error?

Error: Can’t open display: localhost:11.0

  • Ensure xming runs in background
  • Ensure DISPLAY variable is set. If not note session id from below command

#xauth list

and set variable as below.

#export DISPLAY=localhost:11.0

  • If the login user and xterm user is different, then ~/.Xauthority file to be created manually.      Open new PUTTY terminal with X11 forwarding enabled. Copy the current login user cookie     value to clipboard.

#xauth list

login to user where xterm needed and run,

#xauth add “rhel4.example.com/unix:11  MIT-MAGIC-COOKIE-1                          821926769b3de22cb2f9af658a38bb16”

#export DISPLAY=localhost:11.0

Now you will be able to access X-Window system.