JMX authentication

余生颓废 提交于 2019-12-07 05:28:17

问题


$ cd $JAVA_HOME/jre/lib/management
$ cp jmxremote.password.template jmxremote.password
$ chmod u=rw jmxremote.password
$ vi jmxremote.password

Set a password for "monitorRole" and "controlRole":

monitorRole 12monitor
controlRole 55control

After then when I run JMX server on my machine I got following error.

# java -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.m
agement.jmxremote.authenticate=true  -Dcom.sun.management.jmxremote.ssl=false -D
java.rmi.server.host=47.168.96.31  com.example.Main
Error: Password file read access must be restricted: /root/Downloads/jdk1.6.0_29
/jre/lib/management/jmxremote.password

When I change the file permission with the oen of the following commands jmx server works.

# chmod 400  jmxremote.password

or

# chmod 600  jmxremote.password

But I could not connect it through username/password defined in jmxremote.password file


回答1:


To add new username/password for JMX authorization, authentication has to be defined by adding the username in to jmxremote.access file. it should be like when adding username "admin"

>monitorRole   readonly
>admin         readonly
>controlRole   readwrite \
          create javax.management.monitor.*,javax.management.timer.* \
          unregister


来源:https://stackoverflow.com/questions/10596759/jmx-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!