I want to generate password protected directories automatically as we migrate away from manually created password protected passwords in cPanel. I see that cPanel creates the files in /.htpasswds/public_html/EXAMPLE_DIR. PHP doesn't have proper permissions to edit this file and still have Apache run the file as it needs to run as the 'nobody' user and the PHP script isn't in the same permissions group. Which makes sense, so what I tried doing was to create/migrate the passwd file to /public_html/EXAMPLE_DIR , Then update the .htaccess in /EXAMPLE_DIR to point to the new passwd file (now renamed .htpasswd). Except that if I visit the Directory Privacy screen again, it will undo all my work and revert everything somehow. I'm not even sure where it's storing this information that's its recovering these files from.
Since I don't know enough of what cPanel is doing to stop it from meddling, what would be the best way to accomplish this? These directories are using BASIC AUTH as a simple means of login (it's an old site) and I'd like to automate this some. How do I create these programmatically without cPanel screwing it up?
Since I don't know enough of what cPanel is doing to stop it from meddling, what would be the best way to accomplish this? These directories are using BASIC AUTH as a simple means of login (it's an old site) and I'd like to automate this some. How do I create these programmatically without cPanel screwing it up?
Last edited by a moderator: