Xhost command not working

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Xhost command not working
# 1  
Old 12-09-2014
Xhost command not working

Hi,
I am not able to work with the command xhost. I need to open the same machine (not any other remote machine) in UI mode. How can I open this using xhost? I am using Putty to login to this machine.

I am simply writing the command as --> xhost +
There is an error displayed --> xhost: unable to open display "".
Please help on this.

Thanks in advance!
# 2  
Old 12-09-2014
I think - in this case - you don't need xhost at all.

What you need is:
  • X server on Windows (e.g. Xming)
  • Configure the particular putty connection (Enable X11 forwarding)
  • Ensure that the remote server permits X11 forwarding (X11Forwarding yes in sshd_config)
# 3  
Old 12-10-2014
Hi Thanks junior-helper,
I am using VNC on Windows to access a remote RedHat machine, but I receive an error "The connection was refused by the host computer". Th parameter X11 Forwarding is set to yes on the Redhat machine. But still this does not work, any further help on this?
# 4  
Old 12-10-2014
Yes.

I see at least 3 potential problems:
  • You don't have an appropriate VNC server installed on your remote host
  • You have the VNC server, but it's not configured
  • VNC server is configured and up&running, but the firewall blocks incoming connections.
I don't know which of the points mentioned applies to your environment.

Below you will find instructions on how to configure the VNC server on the remote host (installation tested on RH6.4, access tested with Remmina):

Code:
# install vnc server
[root@host ~]# yum install tigervnc-server

# configure vnc server
[root@host ~]# vi  /etc/sysconfig/vncservers

VNCSERVERS="2:someuser"
VNCSERVERARGS[2]="-geometry 800x600"

Add above two lines in the /etc/sysconfig/vncservers file (it will configure display :2 for user someuser).

# switch to user someuser
[root@host ~]# su - someuser

# set vnc password for user someuser
[someuser@host ~]$ vncpasswd 
Password:
Verify:
[someuser@host ~]$ exit

# start vnc server
[root@host ~]# service vncserver start
Starting VNC server: 2:someuser 
New 'host:2 (someuser)' desktop is host:2

Creating default startup script /home/someuser/.vnc/xstartup
Starting applications specified in /home/someuser/.vnc/xstartup
Log file is /home/someuser/.vnc/host:2.log

                                                           [  OK  ]
# check if vnc server is listening on the appropriate port
[root@host ~]# netstat -ant | grep 5902
tcp        0      0 0.0.0.0:5902                0.0.0.0:*                   LISTEN      
[root@host ~]#
# it might be necessary to modify iptables to allow incoming connections on port 5902

Important note: This is an insecure setup (unencrypted connection).

Anyhow, with a minor change in /etc/sysconfig/vncservers (VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"), it is possible to configure vnc server to only accept vnc connections from localhost, or through a ssh tunnel respectively. On Windows, the connection will not work anymore with a VNC client only (no ssh support?), but it should work in combination with Putty.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Xhost usage in AIX

Hi Can some one please advise on the usage of xhost command in aix. The AIX server name is pmut3. The below is the requirement : Only allow X11 / X-Window connections to the pmut3 server from the following windows hosts: Citrix Session Host server SRV090 Citrix Session Host server... (2 Replies)
Discussion started by: newtoaixos
2 Replies

2. UNIX for Dummies Questions & Answers

[Solved] Problem With "xhost +" command-FreeBSD

Does anyone no why "xhost +" would not be working in freebsd? Could it be to do with a certain xorg package not being installed etc.. I am getting error "xhost: command not found" Thanks Anyone (2 Replies)
Discussion started by: Browser
2 Replies

3. UNIX for Dummies Questions & Answers

xhost

Some of my users find that a graphical program I have given them will not run until they type: xhost +local:username where, of course, they substitute in their own user name. My question is what the word "local" is doing there and whether it would work as well without it. Thanks in... (0 Replies)
Discussion started by: Brandon9000
0 Replies

4. UNIX for Dummies Questions & Answers

xWindows error: xhost unable to open display

I am trying to direct a AIX display to my XWindows and I am at a dead end now! So this what I've done so far: 1. In putty settings, I set "Enable X11 forwarding" and also set "X diplay location" to "localhost:0" (without quotes, of course) 2. Via putty, connected to my AIX server 3. On... (1 Reply)
Discussion started by: shoefiend
1 Replies

5. UNIX for Dummies Questions & Answers

Xhost help

Hi all, I am trying to enable usage of X on 2 servers - ServerA and ServerB. I am logged in as root on ServerA and am trying to add ServerB into the access list of A. I am using this: root@ServerA#> export DISPLAY=localhost:20.0 root@ServerA#> xhost +ServerB I am getting the... (3 Replies)
Discussion started by: vishi
3 Replies

6. Shell Programming and Scripting

Include xhost + at auto reboot script

Below is the startup/stop script for vncservers by end-user. How can xhost + command include in this script? Please help. Thank you. #!/bin/sh # # Startup/Stop script for vncservers for some users. # case "$1" in 'start') /bin/rm /tmp/.X11-unix/X0 /bin/su - applprod -c... (0 Replies)
Discussion started by: KhawHL
0 Replies

7. UNIX for Advanced & Expert Users

Xhost and ILO

I have an application that requires me to disable the restricted access to the X Server libraries by issuing the 'Xhost +' command from a Console Window. It is important that this command is run from the Console Window and not a Terminal Window otherwise the system complains that DISPLAY is not... (0 Replies)
Discussion started by: jimthompson
0 Replies

8. UNIX for Advanced & Expert Users

xhost unable to open display

I am trying to install ORACLE 10g database on HP-UNIX 11.11 I am running OUI runinstaller from exceed terminal from windows PC. I have set DISPLAY=IPAddress of PC:0.0 When installer starts it is giving me error of display (5 Replies)
Discussion started by: ymg
5 Replies

9. UNIX for Dummies Questions & Answers

xhost: unable to open display????

I am a dba, not an sa, that recently had to take over administering an HP-UX server. Needless to say I am not in a comfortable area, but found out that of all people I am the most knowledgeable on unix here .... scary thought I know. I am having troubles exporting my display to a Windows XP... (5 Replies)
Discussion started by: soestx
5 Replies

10. UNIX for Advanced & Expert Users

xhost command

Hi, Is there a way to know if user used the xhost command in is current session and to which hosts/users the user give access. (xhost + or xhost + host1 ...) Thanks, Itay. (2 Replies)
Discussion started by: itayst
2 Replies
Login or Register to Ask a Question