mac_g
asked on
How to enable xhost for specific user, to install GUI software
xhost executing successfully for the user who has the direct login access to the OS.
when I swtich to the other user (su) and which doesn't have the direct login access to OS, could not run the xhost command.
Kindly advice, how to achieve the same.
when I swtich to the other user (su) and which doesn't have the direct login access to OS, could not run the xhost command.
Kindly advice, how to achieve the same.
ASKER
Thanks for ur reply ... tried above steps .. Still not working
user which has permission to directly access and Login, then below is output
-------------------------- ---------- ---------- ---------- ---------- ---------- -
[SRV01 ~]$ xeyes } -- working
[SRV01 ~]$ xhost +
access control disabled, clients can connect from any host
[SRV01 ~]$ xauth list
SRV01/unix:10 MIT-MAGIC-COOKIE-1 85220a5aa4b79344209b7ddcd4 cabd29
SRV01/unix:11 MIT-MAGIC-COOKIE-1 6f287330fd375f413418abdc42 2982d0
[SRV01 ~]$
== Now switch to root user with sudo
[SRV01 ~]$ sudo -i
[sudo] password for dems:
[SRV01 ~]# xhost +
MobaXterm X11 proxy: Unsupported authorisation protocol
xhost: unable to open display "localhost:11.0"
[SRV01 ~]# export DISPLAY= 10.10.30.70:0.0
-bash: export: `10.10.30.70:0.0:0.0': not a valid identifier
[SRV01 ~]# xeyes
Error: Can't open display:
[SRV01 ~]#
=== how to achive to display GUI to run the #xeyes
user which has permission to directly access and Login, then below is output
--------------------------
[SRV01 ~]$ xeyes } -- working
[SRV01 ~]$ xhost +
access control disabled, clients can connect from any host
[SRV01 ~]$ xauth list
SRV01/unix:10 MIT-MAGIC-COOKIE-1 85220a5aa4b79344209b7ddcd4
SRV01/unix:11 MIT-MAGIC-COOKIE-1 6f287330fd375f413418abdc42
[SRV01 ~]$
== Now switch to root user with sudo
[SRV01 ~]$ sudo -i
[sudo] password for dems:
[SRV01 ~]# xhost +
MobaXterm X11 proxy: Unsupported authorisation protocol
xhost: unable to open display "localhost:11.0"
[SRV01 ~]# export DISPLAY= 10.10.30.70:0.0
-bash: export: `10.10.30.70:0.0:0.0': not a valid identifier
[SRV01 ~]# xeyes
Error: Can't open display:
[SRV01 ~]#
=== how to achive to display GUI to run the #xeyes
Can you check the ownership of .Xauthority file.
Copy root's .Xauthority file to the installation user's directory.
Example:
cp /root/.Xauthority /home/oracle/.Xauthority
Ensure that the user can read & write to the file:
Example:
chmod 600 /home/oracle/.Xauthority
chown oracle /home/oracle/.Xauthority
Hope this should your problem.
Copy root's .Xauthority file to the installation user's directory.
Example:
cp /root/.Xauthority /home/oracle/.Xauthority
Ensure that the user can read & write to the file:
Example:
chmod 600 /home/oracle/.Xauthority
chown oracle /home/oracle/.Xauthority
Hope this should your problem.
ASKER
we use Mobaxterm tool .. which embedded an Xserver internally ..
[SRV01 ~]# export DISPLAY= 10.10.30.70:0.0
-bash: export: `10.10.30.70:0.0:0.0': not a valid identifier
In above command you are missing " "
export DISPLAY=":0.0"
or
export DISPLAY="10.10.30.70:0.0"
After setting this check using by env | grep DISPLAY
-bash: export: `10.10.30.70:0.0:0.0': not a valid identifier
In above command you are missing " "
export DISPLAY=":0.0"
or
export DISPLAY="10.10.30.70:0.0"
After setting this check using by env | grep DISPLAY
ASKER
i am trying to run GUI command from root it self. ( #xeyes)
Please check my previous post output ..
display command with " .." not worked
# xhost +
xhost: unable to open display "10.10.30.9:0.0"
== If the above xhost command give proper output, then .. issue going to be resolved
Please check my previous post output ..
display command with " .." not worked
# xhost +
xhost: unable to open display "10.10.30.9:0.0"
== If the above xhost command give proper output, then .. issue going to be resolved
Can you paste the output for below commands
echo $DISPLAY
cat /etc/ssh/sshd_config | grep X11
echo $DISPLAY
cat /etc/ssh/sshd_config | grep X11
ASKER
the above requested command results as below
---------
#echo $DISPLAY
10.10.30.9:0.0
[root ~]# cat /etc/ssh/sshd_config | grep X11
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
# X11Forwarding no
[root ~]#
=== the above value s are correct . IP displaying my desktop IP
# xhost +
xhost: unable to open display "10.10.30.9:0.0"
== If the above xhost command give proper output, then .. issue going to be resolved
---------
#echo $DISPLAY
10.10.30.9:0.0
[root ~]# cat /etc/ssh/sshd_config | grep X11
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
# X11Forwarding no
[root ~]#
=== the above value s are correct . IP displaying my desktop IP
# xhost +
xhost: unable to open display "10.10.30.9:0.0"
== If the above xhost command give proper output, then .. issue going to be resolved
Did you define your hostname in /etc/hosts
ASKER
yes .. details ..there already
If /etc/hosts file contains the entry for server
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.30.70 SRV01
You can run the command to access access permission.
#xhost +SRV01
SRV01 being added to access control list (Should be your output)
Then try to reload ssh service.
# service sshd reload
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.30.70 SRV01
You can run the command to access access permission.
#xhost +SRV01
SRV01 being added to access control list (Should be your output)
Then try to reload ssh service.
# service sshd reload
You can install VNC server, It will solve you GUI installations problem.
How to install VNC Server:
https://wiki.centos.org/HowTos/VNC-Server
How to install VNC Server:
https://wiki.centos.org/HowTos/VNC-Server
make sure you connect using ssh -Y rather than -X and use "sudo -E" rather than sudo
ASKER
@skullnobrains,
ssh -Y -- I am using MobaXterm tool which support X-server by default.......this wont help
sudo -E" .. Can't understand .. can u explain .. please.
=
ssh -Y -- I am using MobaXterm tool which support X-server by default.......this wont help
sudo -E" .. Can't understand .. can u explain .. please.
=
you're using ssh : moba is merely ssh client and x server packed together.
it probably already uses -Y
sudo -E preserves the environment. this information is in the man page.
__
actually you need to instruct X to use the same magic cookie before and after you sudo
export XAUTHORITY=$HOME/.Xauthori ty ; sudo -E bash
OR
sudo bash ; export XAUTHORITY=$HOME_OF_NONROO T_USER/.Xa uthority
__
it should also be feasible to symlink ~user/.Xauthority -> /root/.Xauthority
for a permanent setup assuming you are the only one to connect
... or you obviously can directly connect as the root user
it probably already uses -Y
sudo -E preserves the environment. this information is in the man page.
__
actually you need to instruct X to use the same magic cookie before and after you sudo
export XAUTHORITY=$HOME/.Xauthori
OR
sudo bash ; export XAUTHORITY=$HOME_OF_NONROO
__
it should also be feasible to symlink ~user/.Xauthority -> /root/.Xauthority
for a permanent setup assuming you are the only one to connect
... or you obviously can directly connect as the root user
ASKER
Thanks lot @ skullnobrains
>>
below suggested step I have tested .. and working good for ROOT.
actually you need to instruct X to use the same magic cookie before and after you sudo
export XAUTHORITY=$HOME/.Xauthori ty ; sudo -E bash
<<
If I switch to (Ex: su - oracle) to non-root user, can you please advice how to make this to happen.
thanks for your advice
>>
below suggested step I have tested .. and working good for ROOT.
actually you need to instruct X to use the same magic cookie before and after you sudo
export XAUTHORITY=$HOME/.Xauthori
<<
If I switch to (Ex: su - oracle) to non-root user, can you please advice how to make this to happen.
thanks for your advice
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
echo $DISPLAY
If not set run the below command.
export DISPLAY=:0.0
Make sure xorg-x11 package installed, also check authentication information using xauth list
If not set use below export command for specific user.
export XAUTHORITY=~/.Xauthority