Solved

xhost not working

Posted on 2014-09-14
31
1,012 Views
Last Modified: 2014-11-14
[root@oracle ~]# xhost +
xhost:  unable to open display "192.168.0.4:0.0"
0
Comment
Question by:linuxperson
  • 11
  • 9
  • 4
  • +2
31 Comments
 

Author Comment

by:linuxperson
ID: 40322018
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
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 40322060
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
 
LVL 61

Expert Comment

by:gheist
ID: 40322542
ssh (and putty) forwards X11 just fine (if you have xauth installed) so you dont need xhost nowadays.
0
 
LVL 1

Expert Comment

by:Serafin Rusu
ID: 40324013
if you are using centos/redhat enterprise etc use:
yum install xorg-x11-xauth

after that reconnect with ssh on server.
0
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 40324119
>> I am using cents 6.5 and ssh to the machine.
From what kind of machine are  you connecting to your CentOS machine?
0
 
LVL 61

Expert Comment

by:gheist
ID: 40324139
yum install xauth will work on centos and fedora too... (or apt-get install xauth on ubuntu/debian)
0
 
LVL 1

Expert Comment

by:Serafin Rusu
ID: 40325152
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
 
LVL 61

Expert Comment

by:gheist
ID: 40325722
Not really... You can tweak sudoers to not reset $HOME and reuse the X11 session over sudo
0
 
LVL 27

Accepted Solution

by:
serialband earned 300 total points
ID: 40328591
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
 
LVL 61

Expert Comment

by:gheist
ID: 40328810
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
 
LVL 27

Expert Comment

by:serialband
ID: 40328974
@gheist.  I was referring to the xhosts + command as not being needed.
0
 
LVL 61

Expert Comment

by:gheist
ID: 40328991
Open ports neither.... X11 goes over secure channel...
0
 

Author Comment

by:linuxperson
ID: 40329553
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
 
LVL 27

Expert Comment

by:serialband
ID: 40329626
You can be run level 3.  You have still have to have X11 installed.
0
 

Author Comment

by:linuxperson
ID: 40329633
i did install
yum install xorg-x11-xauth

how do i test it?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:linuxperson
ID: 40329634
[root@dev ~]# who -r
         run-level 3  2010-11-04 20:13
0
 

Author Comment

by:linuxperson
ID: 40329636
do i need to say xhost +
0
 

Author Comment

by:linuxperson
ID: 40329638
[root@dev ~]# xclock
Error: Can't open display:

when i try xclock for example. its not working.
0
 

Author Comment

by:linuxperson
ID: 40329640
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
 
LVL 61

Assisted Solution

by:gheist
gheist earned 200 total points
ID: 40329653
So you need to install and start X11 for MacOSX (and mention MAC before you are suggested to install Xming)
0
 

Author Comment

by:linuxperson
ID: 40329658
i am new to mac.
How do i install xming on mac?
0
 

Author Comment

by:linuxperson
ID: 40329659
can i not able to use vnc client on mac?
0
 
LVL 61

Assisted Solution

by:gheist
gheist earned 200 total points
ID: 40329676
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
 
LVL 27

Assisted Solution

by:serialband
serialband earned 300 total points
ID: 40330427
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
 
LVL 1

Expert Comment

by:Serafin Rusu
ID: 40330436
0
 

Author Comment

by:linuxperson
ID: 40330556
i installed xquartz

how do i test it
0
 
LVL 1

Expert Comment

by:Serafin Rusu
ID: 40330568
now run in console:

ssh -X user@server

after login type: firefox or any other x program.
0
 
LVL 61

Expert Comment

by:gheist
ID: 40330697
xdpyinfo is a good test.
(you need xauth on remote machine for ssh -X/-Y)
0
 

Author Comment

by:linuxperson
ID: 40382893
what is good tool in windows i can check xhost option to linux box
0
 
LVL 61

Expert Comment

by:gheist
ID: 40383020
telnet linux 6000
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now