Setting up X forwarding over SSH

From Oracle FAQ
Jump to: navigation, search

If you want to run any of Oracle's GUI tools from a remote machine -- for example, to install Oracle on a remote machine -- you may need to set up X forwarding over SSH.

Add the server's IP and name to your hosts file[edit]

  • On Windows, the hosts file is found in C:\WINDOWS\system32\drivers\etc and is read-only.
  • On a UNIX machine the hosts file is in /etc/hosts. You can add this info to ~/.rhosts instead.

Edit the file and add something like:

11.12.13.14	my.oracle.server.ca	# My Oracle server

Set your display variable and start X on your machine[edit]

  • Windows: You'll need an X server. The easiest (and cheapest) solution is to install cygwin, which is open-source, free, and excellent. Make sure to install the X server when you install Cygwin. Once you've got Cygwin all set up, start it up. You'll be presented with a prompt.
  • Unix: Make sure X is set up on your machine and get yourself a shell prompt.

Set your display environment variable to [your IP address]:0 and start X. This example assumes you're using Bash (the default for Cygwin), and that your IP address is 1.2.3.4:

$ export DISPLAY=1.2.3.4:0
$ startx &

Ssh into the remote machine[edit]

You may want to use a different shell prompt for this command, because the window you used above will be cluttered with X messages. On most systems, "startx" will have popped up an xterm; use that.

$ ssh -l oracle -Y my.oracle.server.ca -b 1.2.3.4
oracle@my.oracle.server.ca's password:
Warning: No xauth data; using fake authentication data for X11 forwarding.
[oracle@my.oracle.server]$ 

You're now logged in to the remote machine. Any X programs you tell it to run will pop up on your local display.

Run X programs[edit]

Test your X setup by running a simple program like xeyes, xclock or runInstaller.

[oracle@my.oracle.server]$ xeyes &

Republished with permission from Natalka Roshak. Original URL: http://www.rdbms-insight.com/toolkit/x_forward.php