cPanel/DirectoryPrivacy
cPanel module

DirectoryPrivacy

6 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="DirectoryPrivacy", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

add_user GET#

Add authorized user for protected directory

This function adds a user who can access a protected directory on the cPanel account.

dirstringRequired
The directory to add users to.
passwordstringRequired
The password for the user.
userstringRequired
The username of the user who can access the directory.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

configure_directory_protection GET#

Enable or disable protected directory

This function enables or disables password protection for a directory on the cPanel account.

authnamestringRequired
The name of the directory protection authorization instance. Note: Only use this parameter when you enable password protection.
dirstringRequired
The absolute or relative directory path for which to enable or disable password protection.
enabledintegerRequired
Whether to enable password protection for the directory. 1 - Enable. 0 - Disable.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

auth_namestring
The authentication resource name.
auth_typestring
The directory's authentication type. Basic None
One of: Basic None
passwd_filestring
The path to the directory's password file.
protectedinteger
Whether the directory uses password protection. 1 - Protected. 0 - Not protected.
One of: 0 1

delete_user GET#

Delete authorized user for protected directory

This function deletes a user who can access a protected directory on the cPanel account.

dirstringRequired
The absolute directory path on the cPanel account from which to remove a user.
userstringRequired
The username to remove from the directory.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

is_directory_protected GET#

Return whether directory uses password protection

This function confirms whether a directory uses password protection.

dirstringRequired
The absolute directory path on the cPanel account to check for password protection.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

auth_namestring
The authentication resource name.
auth_typestring
The directory's authentication type. Basic None
One of: Basic None
passwd_filestring
The path to the directory's password file.
protectedinteger
Whether the directory uses password protection. 1 - Protected. 0 - Not protected.
One of: 0 1

list_directories GET#

Return privacy status of subdirectories

This function returns the privacy status of the subdirectories in a directory.

dirstringRequired
The directory path for which to return the subdirectories' privacy information.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

childrenarray<object>
An array of objects containing subdirectories and their privacy information. Note: The function returns an object for each subdirectory in a directory.
pathstring
The subdirectory's directory path.
stateobject
The subdirectory's privacy information.
auth_namestring
The authentication resource name.
auth_typestring
The subdirectory's authentication type. Basic None
One of: Basic None
passwd_filestring
The absolute file path to the subdirectory's password file.
protectedinteger
Whether the subdirectory is protected. 1 — Protected. 0Not protected.
One of: 1 0
currentobject
The user's current directory and its privacy information.
pathstring
The current directory's path.
stateobject
The current subdirectory's privacy information.
auth_namestring
The authentication resource name.
auth_typestring
The directory's authentication type. Basic None
One of: Basic None
passwd_filestring
The absolute file path to the directory's password file.
protectedinteger
Whether the directory is protected. 1 — Protected. 0Not protected.
One of: 1 0
homeobject
The user's home directory and its privacy information.
pathstring
The home directory's absolute path.
stateobject
The home directory's privacy information.
auth_namestring
The authentication resource name.
auth_typestring
The home directory's authentication type. Basic None
One of: Basic None
passwd_filestring
The absolute file path to the home directory's password file.
protectedinteger
Whether the home directory is protected. 1 — Protected. 0Not protected.
One of: 1 0
parentobject
The parent directory of the current directory and its privacy information.
pathstring
The parent directory's absolute directory path.
stateobject
The parent directory's privacy information.
auth_namestring
The authentication resource name.
auth_typestring
The parent directory's authentication type. Basic None
One of: Basic None
passwd_filestring
The absolute file path to the parent directory's password file.
protectedinteger
Whether the subdirectory is protected. 1 — Protected. 0Not protected.
One of: 1 0

list_users GET#

Return authorized users for protected directory

This function returns the users who can access a password-protected directory on the cPanel account.

dirstringRequired
The password-protected directory for which to return authorized users.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

list of users who can access the directory.