user3339208 user3339208 - 1 month ago 13x
Java Question

Dump keystore content: Permission denied keytool java_cacerts

I am trying to get a dump of my Java keystore content, I am trying with the following query in terminal:

keytool -list -v -keystore /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/security/cacerts > java_cacerts.txt

it throws the following error:

-bash: java_cacerts.txt: Permission denied

I already tried changing permissions on several folders also on the cacerts file itself but without any results.

What could be the problem?


You likely don't have permission to write to your current working directory.
Firstly try creating the file java_cacerts.txt without any keytool command, you should get the same error running something like touch java_cacerts.txt