您可以覆盖-XX + HeapDumpOnOutOfMemoryError生成的堆转储的文件权限吗? [英] Can you override the file permissions for the heap dump produced by -XX+HeapDumpOnOutOfMemoryError?

查看:227
本文介绍了您可以覆盖-XX + HeapDumpOnOutOfMemoryError生成的堆转储的文件权限吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux上,当使用-XX+HeapDumpOnOutOfMemoryError时,所产生的hprof文件由运行Java进程的用户所拥有,并具有600的权限.

On Linux when using -XX+HeapDumpOnOutOfMemoryError the hprof file produced is owned by the user under which the java process is running and has permissions of 600.

我知道这些权限是最好的安全措施,但是可以覆盖它们吗?

I understand that these permissions are best security wise but is it possible to override them?

推荐答案

您可以使用以下方式启动JVM

You can start the JVM with

java -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError="chmod g+r java_pid*.hprof" {mainclass} {args}

该命令在创建堆转储后运行.例如,这将允许组读取访问当前目录中的所有堆转储文件.

The command runs after the heap dump is created. This will allow group read access to all heap dump files in the current directory for example.

这篇关于您可以覆盖-XX + HeapDumpOnOutOfMemoryError生成的堆转储的文件权限吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆