Accessing Linux server from Windows machine in graphical mode via SSH

17,080

You can try to use VNC X server. It uses non-privileged port to communicate and it may be run without any root privileges. To avoid the building of VNC find out what port of it the distro being in use contains (there is a number of options TigerVNC, OpenVNC, RealVNC, e.t.c.).

For example the Fedora 17 has tigervnc-server-minimal package that has everything you need to start a VNC server:

/usr/bin/Xvnc 
/usr/bin/vncconfig 
/usr/bin/vncpasswd 
/usr/share/man/man1/Xvnc.1.gz 
/usr/share/man/man1/vncconfig.1.gz 
/usr/share/man/man1/vncpasswd.1.gz

Download it, extract the binaries and put them into your ~/bin folder for convenience.

First you need to run vncpasswd once at each system to set a password to access your vnc server instance.

Then start the server itself by the command Xvnc and note what display it started (it will print out the info on standard output).

Then you will be setting up a TCP port forwarding with putty to the port with number 5900+<display number>, e.g. for the display :1 you should create a tunnel to port 5901:

putty -ssh -L5901:127.0.0.1:5901 user@host

Then start the VncViewer and connect to the display localhost:1 at your Windows box.

When you are finished don't forget to stop Xvnc server, so it is not wasting the resources at server:

killall Xvnc

The case of aura is a bit more complex as you can't log in directly. If one of your servers allow to set the tunnels to any machine in the LAN, then just create the proper tunnel, say:

putty -ssh -L5901:<ip-of-aura>:5901 user@host

Otherwise, you start the ssh session with aura with port forwarding from the remote shell at aisa or lethe:

ssh -L5901:127.0.0.1:5901 aura
Share:
17,080

Related videos on Youtube

Rasto
Author by

Rasto

Updated on September 18, 2022

Comments

  • Rasto
    Rasto over 1 year

    I need to access one of my school Linux servers from my home computer that runs Windows. And I need to access graphical desktop (X server) on them remotely, not only shell.

    The problem includes 3 Linux servers with different settings. I don't have admin privileges on any of them and cannot change those settings. The 3 servers are called Aisa, Lethe and Aura (somebody loves Greek mythology here). All of them are part of school's local network.

    I need to access graphical interface on either Lethe or Aura, any of them would be fine.

    Here is what I have found out:

    • ports for services like VPN are not available on any of the 3
    • SSH is allowed on Lethe and Aisa, not on Aura. I can still access Aura when I SSH to Aisa or Lethe using Putty and then ssh aura.
    • I have tried Xming program that allows graphical connection from windows to Linux via SSH. I was only able to connect to Aisa this way (why not to Lethe?! Putty works there).

    So what can I try to get graphical connection to either Lethe or Aura from my Windows computer? Any suggestions are very much welcome.

    edit Here is the code showing how I get disconnected from Aura back to Aisa after running vncserver:

    aisa:/home/user>$ ssh aura
    Last login: Sat Oct 13 00:00:00 2012 from aisa.domain.com
    aura:/home/user>$ module add vnc
    aura:/home/user>$ vncserver
    
    New 'aura.domain.com:1 (user)' desktop is aura.domain.com:1
    
    Starting applications specified in /home/user/.vnc/xstartup
    Log file is /home/user/.vnc/aura.domain.com:1.log
    
    aura:/home/user>$ Connection to aura closed by remote host.
    Connection to aura closed.
    aisa:/home/user>$ 
    

    edit 2 Content of file /home/user/.vnc/aura.domain.com:1.log after executing command vncserver:

    aura:/home/user>$ cat /home/user/.vnc/aura.domain.com:1.log
    /packages/run/vnc-4.1.2/Xvnc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
    /home/user/.vnc/xstartup: line 4: xsetroot: command not found
    /home/user/.xsession: line 15: xset: command not found
    vncconfig: unable to open display "aura.domain.com:1"
    /home/user/.xsession: line 42: xmodmap: command not found
    Module xv
    Module modules
    Module viewers
    Module WindowMaker-0.80.2
    Module mozilla
    ModuleCmd_Load.c(199):ERROR:105: Unable to locate a modulefile for 'mozilla'
    stty: standard input: For this device invalid ioctl
    wmaker: error while loading shared libraries: libtiff.so.3: cannot open shared object file: No such file or directory
    

    Note: I have translated some strings that were displayed in czech (Aura is running czech version of Red Hat)