LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-05-2019, 11:45 PM   #1
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 632

Rep: Reputation: 34
Error opening Display (xhost)


Hi I am running a "CentOS Linux release 7.6.1810 (Core)" and "Linux orat 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux". Running this on a Virtual box, on a Windows 10 laptop. Viewer is "Real VNC" and I tried TigerVnc viewer as well.

1. From the console if I do xhost + as root and su - user. I can run xclock and system do not complain

2. But if I use VNC and do the above it complains "unable to open the display"

3. In the same vnc if I do ssh -X user@localhost, no problem I can run xclock

Can any one tell me whats going on

Thanks and Kind Regards

Last edited by procfs; 06-05-2019 at 11:49 PM.
 
Old 06-06-2019, 02:15 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,103

Rep: Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145
You need to understand how the access to X server works.
First of all the only user allowed to use it is the one who started it (= regular user, not root).
Next, only allowed user[s] can set permissions to other users, so root has no extra power either to use or allow to use it.
xost is used to set permission, but you need need to run it as user and also the DISPLAY should be identified.
ssh -X <user>@<remote> will allow the <user> on <remote> to access the current DISPLAY (if exists).

Please post not only the commands you executed, but the response too.
 
1 members found this post helpful.
Old 07-19-2019, 01:23 AM   #3
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 632

Original Poster
Rep: Reputation: 34
Hi pan64, thank you for the explanation, and sorry for the late response!

I am trying to install Oracle database using VNC. Usually what I do is start the VNC server as root and do a "xhost +" change user "su - oracle" and I am able run xclock or any other xcommand but in this system.

VNC start with out any issue and no error in the log as well

Code:
[root@orat ~]# vncserver

New 'orat:1 (root)' desktop is orat:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/orat:1.log

[root@orat ~]#
Content of the log

Quote:
Xvnc TigerVNC 1.8.0 - built Nov 2 2018 19:05:14
Copyright (C) 1999-2017 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12001000, The X.Org Foundation


Fri Jul 19 02:22:07 2019
vncext: VNC extension running!
vncext: Listening for VNC connections on all interface(s), port 5901
vncext: created VNC server for screen 0

Fri Jul 19 02:22:11 2019
ComparingUpdateTracker: 0 pixels in / 0 pixels out
ComparingUpdateTracker: (1:-nan ratio)
Start the vncview from windows > start a xter > run xhot + > su - oracle > xclock (as below)

Code:
[root@orat ~]# xclock (runs xclock no issues)
[root@orat ~]# xhost +
access control disabled, clients can connect from any host
[root@orat ~]# xclock (runs xclock no issues)
[root@orat ~]# su - oracle
Last login: Fri Jul 19 02:19:12 EDT 2019 on pts/1
[oracle@orat ~]$ xclock
Error: Can't open display: 
[oracle@orat ~]$
Is there anything that I am I doing wrong?

Thank you and Kind Regards

Last edited by procfs; 07-19-2019 at 01:25 AM.
 
Old 07-19-2019, 01:55 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,103

Rep: Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145
you need to specify the display.
check the DISPLAY variable settings before su and set it again afterward.
 
1 members found this post helpful.
Old 07-19-2019, 02:29 AM   #5
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 632

Original Poster
Rep: Reputation: 34
Hay Pan64, Yah this works , just trying to understand though, as I never had to do this before (in other systems)

I just put xhost + as root and su - oracle and run
 
Old 07-19-2019, 03:42 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,103

Rep: Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145Reputation: 4145
su - oracle will not keep the variable DISPLAY (and others).
If you think your problem is solved please mark the thread solved.
Also if you wish to say thanks just click on yes.
 
Old 07-19-2019, 03:54 AM   #7
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 632

Original Poster
Rep: Reputation: 34
Hmmmmmm, strange; was trying to understand whats was going on, any how Thank you for taking the time to help out, I do appreciate that!

Kind Regards

Last edited by procfs; 07-19-2019 at 03:57 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
xhost+ (wireshark saw network packets exchange), but still cannot display error szejiekoh Linux - Newbie 5 06-29-2014 04:18 PM
xhost and DISPLAY error miguelchagas Linux - Newbie 2 10-25-2006 05:16 PM
Problem opening Display / xhost + not working rot Linux - Software 2 06-09-2005 01:56 AM
xhost: unable to open display d_kote23 Fedora 1 06-03-2004 08:40 AM
xhost: unable to open display aqoliveira Linux - Networking 4 12-12-2003 04:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration