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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/scruffybear/article/details/85221344

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,

[tom@ocp ~]$ 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,

[tom@ocp ~]export DISPLAY=:0.0

Had below error,

[tom@ocp ~]$ 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.

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

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…

猜你喜欢

转载自blog.csdn.net/scruffybear/article/details/85221344
今日推荐