Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkcert failed adding cert: Access is denied. #231

Open
davidsiagian opened this issue Jan 8, 2020 · 15 comments
Open

mkcert failed adding cert: Access is denied. #231

davidsiagian opened this issue Jan 8, 2020 · 15 comments
Labels
Windows Requires Windows expert

Comments

@davidsiagian
Copy link

davidsiagian commented Jan 8, 2020

Hi,
I tried to use mkcert on Windows.
However when I use mkcert -install, it is failed because access is denied.
I dont know the problem because I use cmd as administrator.

Screenshot_3

@Strandedpirate
Copy link

On windows mkcert -install must be executed under elevated Administrator privileges. Open the command prompt as Administrator and try again.

@arafel
Copy link

arafel commented Jan 10, 2020

Hi
From the image it doesn't look like that cmd is being run as admin; did you right-click on the "command prompt" entry in the menu and choose "run as administrator"? When I do that, it looks like the image attached - note the "Administrator:" in the window title.

2020-01-10 14_23_50-Administrator_ Command Prompt

@davidsiagian
Copy link
Author

@arafel @Strandedpirate Hi, thanks for your respond. My bad, I forgot to give image with cmd run as administrator.
I couldn't find any source with help.

Screenshot_2

@julian-code
Copy link

julian-code commented Feb 22, 2020

I have the same issue.
billede

@jbleyaert
Copy link

I also have this issue.

@Alcadramin
Copy link

same

1 similar comment
@fabianberisha
Copy link

same

@verfault
Copy link

i have this issue too.

@adem
Copy link

adem commented Sep 20, 2020

Looks like this is a permission issue with the keys stored in C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys. When I try to modify the permissions of the parent folder to give the administrator full control for not just the folder, but also its sub-items, I get the following similar error:
image
I haven't been able to resolve the situation yet. I even deleted the files altogether and rebooted, to no avail.

@adem
Copy link

adem commented Sep 20, 2020

Workaround

Until more is known about this issue, you can use the following workaround to install the CA:

  1. Press Windows+R and run certmgr.msc
  2. Right-click on Trusted Root Certification Authorities > All Tasks > Import...
    (At this point, the Store Location was greyed out, and Current User was preselected for me)
  3. Click Browse... > point it to the rootCA.pem file usually located in %localappdata%\mkcert > Next. When in doubt, double-check the output of mkcert -install to find out the root CA path.
  4. Select Place all certificates in the following store > Browse... > Check Show physical stores > Expand Trusted Root Certification Authorities > Select Local Computer > OK > Next > Finish
  5. The message The import was successful. should appear > Click OK
  6. Verify that your CA is recognized:
    image

Note

If you don't explicitly select the physical store Local Computer, you'll very likely run into the following error message, so make sure not to skip that part. This might be linked to the mkcert -install issue we run into.
image

@FiloSottile FiloSottile added the Windows Requires Windows expert label Oct 25, 2020
@cheslijones
Copy link

I have a similar issue. I was able to mkcert -install, but now I'm unable to do anything related to mkcert:

image

@rfay
Copy link

rfay commented Mar 21, 2021

@cheslijones that's mkcert being unable to reaad the CA that's in your own home directory. You need to change the permissions on that directory (AppData\Local\mkcert, or consider deleting the whole directory and doing mkcert -install again. Or is C:\Users\work possibly another user's homedir?

@cheslijones
Copy link

cheslijones commented Mar 21, 2021

Ok, l deleted and retried which worked. That is my homedir.

@LichLord91
Copy link

Until #453 is merged I created a PowerShell script a while back that'll install the RootCA certs for you and replace it if the thumbprints are different/tell you if its already installed. Feel free to use if it if its to your liking. Just run it in the same directory as the rootCA pem files

Gist link

@bstiffler582
Copy link

I was able to resolve this by adding the mkcert executable to the exclusions list in Windows Defender.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Windows Requires Windows expert
Projects
None yet
Development

No branches or pull requests