Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission error when importing certificate to cacerts

I need to import a certificate for some maven repositories into the global keystore. The certificate file is named maven.crt so the command I am running is

keytool -import -keystore $JAVA_HOME/jre/lib/security/cacerts -trustcacerts -alias maven -file maven.crt

It asks me for password and then if I trust the certificate to which I answer yes This is the final output

Certificate was added to keystore
keytool error: java.io.FileNotFoundException: /usr/java/jdk1.7.0_40/bin/java/jre/lib/security/cacerts (Not a directory)

I ran this command as root so I don't know why I am receiving permissions error here.

like image 366
user2847458 Avatar asked Oct 04 '13 16:10

user2847458


People also ask

How do I fix Keytool error?

You need to give it the correct full path to your keystore. the keystore file is here C:\Documents and Settings\Shalini\. android> so when i enter C:\Documents and Settings\Shalini\. android>keytool -list -alias androiddebugkey -keystore .

What is Keytool error?

keytool error: java.io.FileNotFoundException: C:\Program Files (x86)\Java\jre1.8.0_45\lib\security\cacerts (Access is denied) ​This issue occurs because the Windows User used to run the command, does not have access to update the Java TrustStore file 'cacerts'. Solution.


1 Answers

Your path is wrong. cacerts file is in jdk_directory/jre/lib/security.

Try this instead:

keytool -import -keystore /usr/java/jdk1.7.0_40/jre/lib/security/cacerts -trustcacerts -alias maven -file maven.crt
like image 106
Ernestas Kardzys Avatar answered Sep 22 '22 21:09

Ernestas Kardzys