|
X11 forwarding
21 Feb 2007 06:08:02 -0800
comp.sys.mac.system
previous
Ivan...
|
I'm having trouble using X11 softwares remotely using my macbook.
In my /etc/ssh_config I have already set:
ForwardX11 yes
Doug Anderson...
|
Note that sshd_config configures ssh connections coming _into_ your
machine only. So if you are trying to enable X11 forwarding for ssh
connections out of your machine to remote hosts, leave sshd_config
alone. And editing sshd_config won't help with X11 forwarding for ssh
connections out of your machine.
Also, it is standard (and good) practice to leave everything in /etc
alone unless you have a reason to change it. So you can just edit
~/.ssh/config.
Dave Seaman...
|
It's not a good idea to edit files in /etc, since they can be overwritten by a
future system update. My !/.ssh/config contains the lines
Host *
#ForwardX11 yes
ForwardX11Trusted yes
As you can see, I no longer use ForwardX11, since I am setting
ForwardX11Trusted instead. This is equivalent to using "ssh -Y" instead of
"ssh -X".
|
Dave Seaman...
|
If you do this on the remote machine that you are connecting to, it will
break your X11 forwarding. At the least, you should check to see whether
DISPLAY has already been set:
if [ -z DISPLAY ]
then
export DISPLAY=:0.0
fi
|
Tom Stiller...
|
If Forwarding is set up correctly, the DISPLAY variable will be set
properly and automatically.
|
Also, if you use -Y below, you don't need to do step 3 at all. So I
use steps 1, 2, 4 and 5.
|
but it still doesn't work.
Jim Jennings...
|
Mine works.
I also have in /etc/sshd_config (notice "d" in file name) of the remote
Dave Seaman...
|
Many machines are already configured to accept X11 forwarding. But if
the one you are connecting to is not so configured, then there is no way
around it. You must edit /etc/sshd_config (or whatever the appropriate
pathname is on the remote machine) and restart sshd, or at least send it
a HUP signal.
Jim Jennings...
|
machine (the "X client" in the non-intuitive X terminology, yes?):
X11Forwarding yes
You will probably need root access on the remote machine to do this, or
ask the sys admin to do it for you (if it isn't set already).
Is your firewall running on the Mac? If so you will need to "allow"
X11 in System Preferences/Sharing/Firewall.
I start the X11 app on the Mac before I launch an ssh session from the
terminal. When I launch the ssh session I use ssh -Y. I don't
remember why exactly I use ssh -Y instead of ssh -X. I think some X
apps on the remote machine did not display correctly on the Mac using
ssh -X.
Before I start the ssh session I set DISPLAY to :0.0 on the Mac (my
tcsh .login does it for me if DISPLAY is undefined). On the remote
machine I do nothing with the DISPLAY variable and it is automatically
set to localhost:10.0
If I try to start the ssh session first and then launch the X11 app on
the Mac (backwards) I get:
Warning: No xauth data; using fake authentication data for X11 forwarding.
... when the ssh session starts.
Then, after starting X11 on the Mac I get:
Xlib: connection to "localhost:10.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key
Error: Can't open display: localhost:10.0
...when I try to launch an X app on the remote machine.
Hope this helps.
|
I'm using Terminal.
Tom Stiller...
|
For what? If you want to run a remote X11 client, you should start the
X11 server locally and use xterm to connect to the remote host.
Dave Seaman...
|
You don't need to use xterm. Terminal will work, but you do have to set
DISPLAY to :0.0 if you are using Terminal. This is automatic in xterm.
And, to the OP, you need to be more specific about what "it still doesn't
work" means. What command are you typing, and what response do you get?
|
Jim Jennings...
|
That works too.
If Ivan is like me he likes terminal better than xterm. I still have
to launch X11 locally of course. It works fine for me if I start the
ssh session with ssh -Y.
Do you also do ssh -Y from xterm? Just curious...
|
|
Can anyone help?
Dave Seaman...
|
You don't need to change /etc/ssh_config. All you need is to specify the -Y
option when you connect:
ssh -Y
or else place the following in your ~/.ssh/config file:
Host *
ForwardX11Trusted yes
|
|
next
|