Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

xhost not working

Posted on 2014-09-14
31
1,359 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 38

Expert Comment

by:Gerwin Jansen, EE MVE
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 62

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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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 38

Expert Comment

by:Gerwin Jansen, EE MVE
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 62

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 62

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 29

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 62

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 29

Expert Comment

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

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 29

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
 

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 62

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 62

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 29

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 62

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 62

Expert Comment

by:gheist
ID: 40383020
telnet linux 6000
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

861 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