Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMX authentication

$ 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

like image 572
Ahmet Karakaya Avatar asked May 15 '12 08:05

Ahmet Karakaya


People also ask

What is JMX authentication?

JMX (Java Management Extensions) technology provides a simple and standard way of managing and monitoring resources related to an instance of a Java Virtual Machine (JVM). This is achieved by instrumenting resources with Java objects known as Managed Beans (MBeans) that are registered with an MBean server.

What is JMX and how it works?

JMX technology provides a component-based architecture for developing solutions to monitor and manage your applications, services, and resources. JMX technology is the way to instrument any application or service that was built using Java technology.

What is a JMX connection?

Java Management Extensions (JMX) is a Java technology that supplies tools for managing and monitoring applications, system objects, devices (such as printers) and service-oriented networks. Those resources are represented by objects called MBeans (for Managed Bean).


1 Answers

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
like image 161
Ahmet Karakaya Avatar answered Oct 13 '22 00:10

Ahmet Karakaya