7

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)

2 Answers 2

3

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
0
0

VNC is not the easiest way to run a GUI program. It has additional benefits over the straight remote X method, such as not killing the program if the connection goes down, but it requires more programs running on the remote side. I recommend Xming + PuTTY or Xming + Cygwin SSH for the easy way.

Run the Xming server, then run PuTTY, telling it to forward X. Since you can run X programs on Aisa, you've already got that part working. Make sure that you've enabled X forwarding to Lether and Aura too.

The reason this doesn't work on Lethe may be that X forwarding is disabled, or it might be that it's lacking some libraries. Check the value of the DISPLAY environment variable in the SSH session (echo $DISPLAY). You should see somehing like localhost:10.0. If the value is empty, then the X forwarding failed. This may be because it has been disabled by the system administrator. Check the SSH server configuration, usually in /etc/sshd_config or /etc/ssh/sshd_config. It should contain the line X11Forwarding yes. If it doesn't, ask your system administrator to add it (there is no security risk to the server in doing so, since the client takes all the risks and it can be set up manually anyway — having the option default off doesn't make any sense, but that's how it is in the default OpenSSH configuration).

If X11 forwarding is disabled on the server, you may still be able to make it work, but it takes some effort. You'll need to set up a port forwarding of port 6010 on the remote side to port 6000 on localhost: port 6000+N corresponds to the DISPLAY value :N.0. Set the DISPLAY environment variable accordingly, e.g. export DISPLAY=localhost:10 for port 6010. If port 6010 is taken on Lethe, pick a different one. Then you'll need to copy the X cookie to the remote system. I don't know how to extract the cookie with Xming. On the server side, run xauth add localhost:10 0123456789abcdef0123456789abcdef (the 32-digit hexadecimal number is the cookie value).

For Aura, use SSH tunnelling. Tell PuTTY to connect to Aisa (with agent and X11 forwarding enabled), then run the command ssh -X there.

You must log in to answer this question.

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