When attempting to issue a new certificate via AutoSSL, you see an error similar to the following:
An error occurred the last time AutoSSL ran
HTTP DCV: The system failed to create the directory "/home/exampleuser/public_html/.well_known" because of an error: Permission Denied
This problem is happening because the ownership and/or file permissions not set up properly in one of the directories on the server.
Use the following techniques to troubleshoot this issue.
1. Login to the server via SSH or Terminal as the root user
2. Copy the path from the error message that you found from AutoSSL and use it in the following command:
namei -l /replace/this/path/with/the/one/from/your/error/message
That command will print the ownership and permissions for every folder in the path.
Another command that you can use to check ownership and permissions is the stat command:
The stat command only shows information for one file or folder at a time, so you may need to un the stat command on each and every folder up the path to uncover the issue.
The following articles explain what the default permissions are for some of the folders that are most commonly set up incorrectly:
- What are the default permissions of /home and /home/$user ?
- What are the default file permissions of public_html?
If those guides don't cover your specific situation, you might consider comparing the permissions of the problematic server with another cPanel server that has the same configuration but is working correctly to see what the default permissions should be.
And the following guide provides guidance on how to change file permissions: