Could not obtain certificates: Could not create required directories

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g., so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:

I ran this command: docker run -it -v /STORAGE/Sites/certs:/.lego -v /STORAGE/Sites/ xenolf/lego --email="" --webroot /tmp/webroot --domains="" run

It produced this output: 2018/06/29 16:20:51 No key found for account Generating a curve P384 EC key.
2018/06/29 16:20:51 Saved key to /.lego/accounts/
2018/06/29 16:20:53 [INFO] acme: Registering account for
2018/06/29 16:20:53 !!! HEADS UP !!!
2018/06/29 16:20:53
Your account credentials have been saved in your Let’s Encrypt
configuration directory at “/.lego/accounts/”.
You should make a secure backup of this folder now. This
configuration directory will also contain certificates and
private keys obtained from Let’s Encrypt so making regular
backups of this folder is ideal.
2018/06/29 16:20:53 Please review the TOS at
2018/06/29 16:20:53 Do you accept the TOS? Y/n
2018/06/29 16:21:17 [INFO][] acme: Obtaining bundled SAN certificate
2018/06/29 16:21:18 [INFO][] AuthURL:
2018/06/29 16:21:18 [INFO][] acme: Trying to solve HTTP-01
2018/06/29 16:21:18 [] Could not obtain certificates
[] error presenting token: Could not create required directories in webroot for HTTP challenge -> mkdir /tmp/webroot/.well-known/acme-challenge: permission denied

My web server is (include version): Mac OS Server 5.2

The operating system my web server runs on is (include version): Mac OS X 10.11.6

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don’t know):

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):

Please help! SSL Certificate expired days ago, renewal status is still pending for days now.

It looks like this directory (which presumably contains your web site's content) can't be written to by the user as whom you're running docker. This is a requirement for the method that you're using, so you'll need to change the permissions on this directory or else run docker as a different user.

Thanks for your response schoen. Ran the command in bash actually…
bash-3.2# docker run -it -v /STORAGE/Sites/certs:/.lego -v /STORAGE/Sites/ xenolf/lego --email="" --webroot /tmp/webroot --domains="" run

So you’re running the command as root?

So you’re running the command as root? - Yes

Was thinking maybe the certificate has expired already, that’s why it’s getting denied permission? Is there a way to re-create, start cert request from scratch, maybe?

This is a file permission error, which is unrelated to the certificate’s validity.

Can you try running mkdir /STORAGE/Sites/ outside of Docker?

Where did you get this Docker image or instructions?

That worked outside Docker. test folder created.

Where did you get this Docker image from; which image is it?

@bmw, have you ever seen a case where commands that work outside of Docker don’t work inside of Docker on a bound directory?

No idea about the image. Tried running previous commands to renew same cert months ago… Took over this task recently. :-/

Hmmm! Maybe you could replace this part

xenolf/lego --email="" --webroot /tmp/webroot --domains="" run

with just bash, forming a command like

docker run -it -v /STORAGE/Sites/certs:/.lego -v /STORAGE/Sites/ bash

and then you would have a shell prompt with the same environment that the lego command would have had. In that case you can run id to see if you are still considered root inside of docker, and you can also try running mkdir to see if you can create /tmp/webroot/.well-known and then /tmp/webroot/.well-known/acme-challenge inside of docker.

Not sure if I did it correctly, but am getting same result: denied permission.

Thanks for your time, shoen. Solved this one —

sudo certbot certonly --webroot -w /STORAGE/Sites/ -d

sudo openssl pkcs12 -export -inkey “/etc/letsencrypt/live/” -in “/etc/letsencrypt/live/” -certfile “/etc/letsencrypt/live/” -out “/etc/letsencrypt/live/”

sudo security import “/etc/letsencrypt/live/” -f pkcs12 -k /Library/Keychains/System.keychain -T /Applications/

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.