title: JMX authentication
body: <pre><code>$ cd $JAVA_HOME/jre/lib/management
  $ cp jmxremote.password.template jmxremote.password
  $ chmod u=rw jmxremote.password
  $ vi jmxremote.password
  </code></pre>
  
  <p>Set a password for "monitorRole" and "controlRole":</p>
  
  <pre><code>monitorRole 12monitor
  controlRole 55control
  </code></pre>
  
  <p>After then when I run JMX server on my machine I got following error.</p>
  
  <pre><code># 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
  </code></pre>
  
  <p>When I change the file permission with the oen of the following commands jmx server works.</p>
  
  <pre><code># chmod 400  jmxremote.password
  </code></pre>
  
  <p>or</p>
  
  <pre><code># chmod 600  jmxremote.password
  </code></pre>
  
  <p>But I could not connect it through username/password defined in jmxremote.password file</p>