Re: Where is this "xhost" command?
Re: Where is this "xhost" command?
- Subject: Re: Where is this "xhost" command?
- From: Kevin Geiss <email@hidden>
- Date: Wed, 20 Oct 2004 13:28:01 -0700
This is a post I put up on another list a while back. it has lots of
details. Remember, the DISPLAY variable you got when you're logged in
to the solaris box shouldn't be the ip address of your mac, it needs to
be to a socket on the solaris box which ssh has set up for you to
tunnel the X connection through.
here's the post:
to forward X over ssh in terminal.app there are two main things you
have to accomplish: 1. make sure your X server is running & set your
DISPLAY to use your X server. 2. ssh to the remote machine with X
forwarding turned on. there are several ways to accomplish 2.
first run the X server. then in terminal.app, set your DISPLAY
environment variable. if you're using bash as your shell (which i think
is the default in panther) just type this:
export DISPLAY=":0.0"
if you're using tcsh the command would be
setenv DISPLAY ":0.0"
(the easy way to tell which shell you are running is to type 'ps' and
you should see either tcsh or bash somewhere in the output)
at this point you should be able to run an X client locally and have it
display. try running 'xclock'.
once that works, then you can ssh to a remote machine with X tunneling
turned on by typing this:
ssh -X remote_hostname
once you're logged into the remote machine, try running xclock or xterm
and it should display back on your mac.
one the remote machine, your DISPLAY environment variable will be set
for you by ssh. see what it looks like by typing this:
echo $DISPLAY
I got localhost:10.0 as output. what's happened is that ssh has set up
an encrypted tunnel and remote xclients connect to that tunnel on the
remote machine. the other end of the tunnel is connected back to your
mac. (normally without all this encrypted forwarding business you would
simply set your display on the remote machine to the ip address of your
mac with :0 appended to it)
now all this is only good for the current session. if you want to make
it so it is all set up automatically we'll need to add the DISPLAY
setting to your shell's start up files and turn on X forwarding in your
ssh client's config files.
if you're using bash you can add this bit of code to either the .bashrc
or .bash_profile file in your home directory using a text editor:
if [ ! $DISPLAY ] ; then
export DISPLAY=:0.0
fi
that bit of code sets your DISPLAY only if it's not already set (just
in case you ever ssh into your mac from another machine, you don't want
to clobber X forwarding in the other direction).
if you're using tcsh add this to your .login file in your home
directory:
if ( !$?DISPLAY ) then
setenv DISPLAY ":0.0"
endif
now you need to tell your ssh client to do the forwarding.
use a text editor to edit the file /etc/ssh_config
you will see some lines similar to
Host *
ForwardAgent no
ForwardX11 yes
along with some other stuff. the difference will be that those lines
may be commented out, and ForwardX11 will probably be 'no'. uncomment
the lines (remove the leading # sign) and change ForwardX11 to yes.
now to make sure it all works quit terminal.app and re-run it. check
your DISPLAY:
echo $DISPLAY
if it's not set to :0.0 then try putting that code above in the other
rc file for your shell.
once that's set you should be able to ssh to the remote machine without
having to set your display by hand and without adding the -X flag to
the command line of ssh
if you ssh to the same hosts a lot, you can save terminal sessions
which when you click on them will run the ssh command, which is even
more convenient.
On Oct 20, 2004, at 12:49 PM, Surya wrote:
Hi All,
Thanks for all your repsonses. I am still stuck in the same
situation and need more help. I tried xhost + and then tried to login
to the other machine. I even exported the display from the solaris
machine. The solaris machine does have X11Forwarding set to yes in
/etc/sshd_config. This time the echo $DISPLAY shows the IP of the MAC
but when I try running any Xapps like xclock it gets stuck. No error
just hangs there. The shell on both Solaris and MAC is bash.
More Suggestions needed?
Ashish
" xhost command only works from the xterm run on X11 OS X "
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden