Sunday, June 15, 2008

Remotely using Linux X Window from Windows XP

Remotely using X Window from Windows XP

This is a little piece of note I wrote for myself in case I forgot all the commands I have been using to remotely login to Linux X window systems.

Remotely running X window applications

Will need to firstly login to a Linux login server (local machine), and then from there redirect the remote Linux machine X window to my local machine.

  1. if I start from my windows machine, I will need either PUTTY or other SSH clients. First, I need to log on to xxx_local Linux machine
  2. check whether VNC server is running. If not, use “vncserver :1” to enable VNC service as virtual display 1.
  3. enter /jzhou/.vnc directory and uses “vncpasswd” to configure a simple password for VNC session
  4. then go back to my laptop or a windows machine to run VNC viewer to login to this xxx_local Linux machine through “xxx_local:1” string
  5. after logged in, I should be able to see the desktop of my login server. From there, I can remotely login to any of my Linux machine at work, and run X windows applications.
  6. for example, I can run the following command “echo $DISPLAY” to check my current virtual display and host name (assuming it is “xxx_local:1”).
  7. and then I can use “ssh –X root@xxx_remote” to remotely login to another Linux machine.
  8. from the remote machine, I can use “DISPLAY=xxx_local:1” to redirect X window to my local machine. Note that there is no space.
  9. now, I can go back to my local machine i.e. xxx_local, and use “xhost xxx_remote” to tell my local machine that it is OK for the remote machine to send X window to my local machine.
  10. then, I can run X window applications such as “xclock” from my remote machine, and then get the GUI window on my local machine.

Completely log on to the remote Linux and use the default desktop

To completely log on to the remote Linux machine, we can use VNC server. This requires the VNC server service running on the remote machine. Assuming we already have the VNC server installed on the remote machine, we only need to do the following configurations:

  1. run VNC service “service start vncserver”
  2. run “vncpasswd” to configure a simple password for VNC session
  3. run “vncserver”
  4. enter my home directory and enter ./vnc directory, and vi xstartup file
    uncomment the following two lines
    unset SESSION_MANAGER
    exec /etc/X11/xinit/xinitrc
  5. change the last line to “startx &” (or “startkde &” for KDE)
  6. restart VNC service. Can use “vncserver –kill:1” to kill VNC
  7. under Linux Fedora, we can further configure VNC as a service and let it automatically start every time we start the computer. First, we need to edit /etc/sysconfig/vncservers file:
    VNCSERVERS="1:root"
    VNCSERVERARGS[1]="-geometry 1024x768"
  8. run “vncserver –kill:all”
  9. run “service vncserver start”
  10. from my laptop or another Windows machine, now I can use VNC viewer to remotely login to this machine through “xxx:1” string.

0 Comments:

Post a Comment

<< Home