This function enables or disables password protection for a directory on the cPanel account.
uapi --output=jsonpretty \ --user=username \ DirectoryPrivacy \ configure_directory_protection \ dir='/home/example/example.com' \ enabled='1' \ authname='protectandserve'
{- "apiversion": 3,
- "func": "configure_directory_protection",
- "module": "DirectoryPrivacy",
- "result": {
- "data": {
- "auth_name": "protectandserve",
- "auth_type": "Basic",
- "passwd_file": "/home/example/.htpasswds/example.com/passwd",
- "protected": 1
}, - "errors": null,
- "messages": null,
- "metadata": { },
- "status": 1,
- "warnings": null
}
}