xhost not working

[root@oracle ~]# xhost +
xhost:  unable to open display "192.168.0.4:0.0"
linuxpersonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

linuxpersonAuthor Commented:
FYI

I am using cents 6.5 and ssh to the machine.

[root@oracle ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)

[root@oracle ~]# xhost +
xhost:  unable to open display "192.168.0.4:0.0"

[root@oracle ~]# export DISPLAY="127.0.0.1:0.0"
[root@oracle ~]# xhost +
xhost:  unable to open display "127.0.0.1:0.0"


[root@oracle ~]# export DISPLAY=":0.0"
[root@oracle ~]# xhost +
xhost:  unable to open display ":0.0"

None of them working

[root@oracle ~]# who -r
         run-level 5  2010-11-01 10:32
0
Gerwin Jansen, EE MVETopic Advisor Commented:
From what machine are you connecting? If  you were connecing from a Windows machine using PuTTY for example that  you will not be able to open a display the way you are trying it.

If you want to open a graphical display, then you need to run an x server on you Windows machine, for example xming - http://sourceforge.net/projects/xming/
0
gheistCommented:
ssh (and putty) forwards X11 just fine (if you have xauth installed) so you dont need xhost nowadays.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Serafin RusuNetwork EngineerCommented:
if you are using centos/redhat enterprise etc use:
yum install xorg-x11-xauth

after that reconnect with ssh on server.
0
Gerwin Jansen, EE MVETopic Advisor Commented:
>> I am using cents 6.5 and ssh to the machine.
From what kind of machine are  you connecting to your CentOS machine?
0
gheistCommented:
yum install xauth will work on centos and fedora too... (or apt-get install xauth on ubuntu/debian)
0
Serafin RusuNetwork EngineerCommented:
hmm.

How to you connect to that machine? direct with root account?
If you are using user account to connect and after that if you do "su -" to change user you will loose the xauth session.

if you need root rights you must connect with root user directly.
0
gheistCommented:
Not really... You can tweak sudoers to not reset $HOME and reuse the X11 session over sudo
0
serialbandCommented:
xhosts +  is a good way to open up your X11 to be intercepted.  I would only ever use that to do a quick test and close it immediately.  As mentioned by others, it is no longer needed and hasn't been needed for well over a decade.

You gain access to the other X session by obtaining the xauth key.

Have you checked that you allowed X11 in your /etc/ssh/sshd.conf on the system you're connecting to?

Have you enabled X11 on your local client?  If not, you can do a one time enable by using +X in your ssh call?

Have you checked to see if ports 6000-6007 for X11 are blocked?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gheistCommented:
xhosts controls X server. Not having X11 connection it will not work at all
with ssh X11 forwarding you dont need to open the ports
0
serialbandCommented:
@gheist.  I was referring to the xhosts + command as not being needed.
0
gheistCommented:
Open ports neither.... X11 goes over secure channel...
0
linuxpersonAuthor Commented:
I am ssh from mac os.

In order to use x11 feature should i have to be in run level 5?

Can i be in run level 3 and try to ssh with x11 feature?
0
serialbandCommented:
You can be run level 3.  You have still have to have X11 installed.
0
linuxpersonAuthor Commented:
i did install
yum install xorg-x11-xauth

how do i test it?
0
linuxpersonAuthor Commented:
[root@dev ~]# who -r
         run-level 3  2010-11-04 20:13
0
linuxpersonAuthor Commented:
do i need to say xhost +
0
linuxpersonAuthor Commented:
[root@dev ~]# xclock
Error: Can't open display:

when i try xclock for example. its not working.
0
linuxpersonAuthor Commented:
mac$ ssh -X root@192.168.0.11
root@192.168.0.11's password:
Last login: Thu Nov  4 20:31:34 2010 from 192.168.0.3
[root@dev ~]#
[root@dev ~]#
[root@dev ~]# xclock
Error: Can't open display:
[root@dev ~]#
0
gheistCommented:
So you need to install and start X11 for MacOSX (and mention MAC before you are suggested to install Xming)
0
linuxpersonAuthor Commented:
i am new to mac.
How do i install xming on mac?
0
linuxpersonAuthor Commented:
can i not able to use vnc client on mac?
0
gheistCommented:
It has nothing to do with VNC. You need X11 from apple installed for X11 applications (like X11 forwarding with ssh -X, or NX client) to work.
0
serialbandCommented:
xming is for Windows.  You need XDarwin or XQuartz for a Mac and you don't need to start it before you connect.  They should start for you if they're installed.

You do not need to run xhosts +.  It's insecure.
0
Serafin RusuNetwork EngineerCommented:
0
linuxpersonAuthor Commented:
i installed xquartz

how do i test it
0
Serafin RusuNetwork EngineerCommented:
now run in console:

ssh -X user@server

after login type: firefox or any other x program.
0
gheistCommented:
xdpyinfo is a good test.
(you need xauth on remote machine for ssh -X/-Y)
0
linuxpersonAuthor Commented:
what is good tool in windows i can check xhost option to linux box
0
gheistCommented:
telnet linux 6000
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.