starting X through ssh
ok i have 2 computers running red hat 7.3. Each has X installed. when i ssh into one computer from another, is there any way to use a GUI while working through ssh? kind of like pcanywhere or windows remote desktop? if so can you please explain how to do this. I know whenever I enter any X commands in ssh it tells me that X is already running on display 0. can anyone help me out?
|
I usually run the X display of the ssh server in a window on the client.
You can do this with vnc. http://www.tightvnc.com/ http://www.uk.research.att.com/vnc There are very many possibilities with vnc. I normally use it by forwarding the vncserver listening port on the server to the client via ssh, then connect to the clients local port with vncviewer. This encrypts the connection. http://www.uk.research.att.com/vnc/sshvnc.html |
I agree with David - VNC is much more protable through distributions but Xforwarding is much faster on slower networks.
|
simple:
on your remote machine simply type: export DISPLAY=ipofmachineyouwantdisplayon:0.0 ipofmachineyouwantdisplayon obviously means just that, then just type your command and viola...magic |
Quote:
|
that's right,
now here is another suggestion that you might try 1. start a normal X session on the local machine 2. open an xterm 3. run this command in the xterm xhost +remotemachine 4. run this command in the xterm ssh -X remotemachine That's it, just run any X app you want on the remote machine by typing the command in the xterm Also if you start X on the local machine without a window manager you could also run a window manager from the remote machine, because it's an X app, that's a lot slower though. You really just want to run the X apps for the best performance. |
While this is not a remote desktop, unless you start a window manager from the xterm. It is by far the best way to be able to run X apps on a remote machine and still maintain security.
If you want a remote desktop I would go with vnc over ssh or setup your local machine to where you can run xinit without starting a window manager and then crank up wmaker or other wm from the ssh login. |
Ok
One more time I decided to try the window manager and see if there would be a problem. Here is what you will probably run into. If you have a file /etc/skel/.xinitrc or /home/username/.xinitrc that starts a window manager on the local machine you need to move or edit it then run the command... xinit you will get an xterm with no window manager then run .. xhost +remotemachine then.. ssh -X remotemachine then.. wmaker or other window manager to start the remote desktop |
On the host machine, edit the /etc/ssh/sshd_config file. Make sure you have the following lines enabled (set to yes):
X11Forwarding yes X11DisplayOffset 10 X11UseLocalhost yes restart sshd. On the client machine (the one you are sshing from), edit the /etc/ssh/ssh_config file and make sure the following lines are enabled: ForwardAgent yes ForwardX11 yes Make sure you don't have a local (~/.ssh_config) file that overrides these directives. From an X session on your client machine, ssh in to your host machine and run an X program (xv, for example). xv should pop up on your local machine. It's running on your host machine. . . Do the same for other programs. |
If you still want to run the hosts window manager then you can also bypass the .xinitrc like this from a terminal
xinit -e ssh -X remotemachine wmaker X will start and you will be logged into remotemachine, then wmaker will start If you already have a X server running on the local machine use something like this xinit -e ssh -X remotemachine wmaker -- :1 |
I tried this:
xinit -e ssh -X remotemachine gnome-session -- :1 however it just opened up a new xsession on the local machine, rather than the remote machine! |
does it prompt for your ssh password (if you use one) or give errors?
maybe try it one step at a time xinit -e ssh -X remotemachine -- :1 then run gnome-session |
someone else want to test this?
xinit -e ssh -X remotemachine wmaker -- :1 remotemachine being the FQDN (domain name) or ip address of the machine you are connecting to, and wmaker being any valid window manager on your system I have only tried the following Slackware 9.0.0 connecting to RedHat 7.3 |
One thing that might cause a problem is trying to run the command from within X. ctrl_alt_F1, F2, F3, etc. out to a terminal and try it there if your getting errors in an xterm.
|
Okay... I am getting a bit confused here.. but Msound, are you trying to run an entire nested Xwindows session on your remote desktop.. or are you simply trying to have Xwindows applications that are running on the remote server displayed on your local machine?
I agree with the posters above, in that if you are trying to run an entire desktop, then VNC is definitely the way to go. "man vncserver" and "man vncviewer" for all the info you need. If however, you just want to have say something like Mozilla running on the remote server, but displaying on your local machine... then it should work by default with RH v7.3. Just ssh into the remote server and issue the command line command for whatever app you want to run (i.e. "mozilla", etc) and it will by default display on your local machine. -KevinJ |
All times are GMT -5. The time now is 01:08 PM. |