Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2534
  • Last Modified:

xhost not working

[root@oracle ~]# xhost +
xhost:  unable to open display "192.168.0.4:0.0"
0
linuxperson
Asked:
linuxperson
  • 11
  • 9
  • 4
  • +2
4 Solutions
 
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
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
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
 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 11
  • 9
  • 4
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now