JMX authentication
authentication, jmx
Solution
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
Problem
``` $ 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