1. 程式人生 > >Running GUI application as another (non-root) user - Netmgr

Running GUI application as another (non-root) user - Netmgr

文章目錄

Summary

I can open the Netmgr in the Xshell through Xmanager without any issue. There was problem to do so using Oracle user under xWindows. Resolved it by setting “DISPLAY=:0.0”.

Problem

Need to use Netmgr GUI in xWindows. Error as below,

[[email protected] ~]$ netmgr
****DISPLAY environment variable not set!
    Oracle Net Manager is a GUI tool which
    requires that DISPLAY specify a location
    where GUI tools can display.
    Set and export DISPLAY, then re-run.

After setting below,

[[email protected] ~]export DISPLAY=
:0.0

Had below error,

[[email protected] ~]$ netmgr
Exiting
java.lang.NullPointerException
	at oracle.ewt.lwAWT.BufferedApplet.<init>(Unknown Source)
	at oracle.sysman.emSDK.client.appContainer.WebApplication.<init>(WebApplication.java:752)
	at oracle.net.mgr.container.NetApplication.<
init>(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at java.lang.Class.newInstance0(Class.java:350) at java.lang.Class.newInstance(Class.java:303) at oracle.sysman.emSDK.client.appContainer.WebApplication.main(WebApplication.java:3316)

Solution

The problem is normal Oracle user doesn’t have the same priviledge as root to use GUI, this issue can be resolved by below command.

[[email protected] Desktop]# xhost +
access control disabled, clients can connect from any host
[[email protected] Desktop]# DISPLAY=:0.0
[[email protected] Desktop]# export DISPLAY
[[email protected] Desktop]# xhost +
access control disabled, clients can connect from any host
[[email protected] Desktop]# su - tom  #tom is the normal Oracle user.
Last login: Sun Dec 23 10:35:02 SGT 2018 on pts/4
[[email protected] ~]$ DISPLAY=:0.0
[[email protected] ~]$ export DISPLAY
[[email protected] ~]$ netmgr
[[email protected] ~]$ 

The command xhost + meaning is as below,

+       Access is granted to everyone, even if they aren't on the list (i.e., access control is turned off).

netmgr

Reference

Running GUI application as another (non-root) user
關於在linux上啟用dbca,netmgr,netca等命令的問題
xhost + unable to Open Display…