protdir: Site Directories Protection
The protdir
utility is used to manage password protection of Web directories on domains through CLI. By using this utility, you can perform the following tasks:
- Creating, renaming, and removing protected web directories
- Adding and removing users authorized to access password-protected web directories
- Editing login information of users authorized to access password-protected web directories
Usage
protdir <command> [<directory_name>] [
<option_1> [<param>]
[<option_2> [<param>]]
... [<option_N> [<param>]]
]
Example
The following command creates password-protected directory Protected_Dir
in the /httpdocs
directory on domain example.com, adds the password-protected directory user JDoe, and sets the user password to userpass.
plesk bin protdir --create Protected_Dir -domain example.com -add_user JDoe -passwd userpass -type nonssl
Commands
Command | Parameter | Description | Example |
---|---|---|---|
|
|
Creates a password protected directory on a domain. If the directory already exists on the domain, the command enables password protection of the directory. Requires the |
To create password-protected directory plesk bin protdir --create Protected_Dir -domain example.com -type nonssl or plesk bin protdir -c Protected_Dir -domain example.com -type nonssl |
|
|
Updates settings of a password-protected directory. |
To set title "This directory is password protected" for the login dialog box to be displayed when users attempt to access password-protected directory plesk bin protdir --update Protected_Dir -domain example.com -title "This directory is password protected" or plesk bin protdir -u Protected_Dir -domain example.com -title "This directory is password protected" |
|
|
Removes password protection from a directory. |
To remove password protection from the directory plesk bin protdir --remove Protected_Dir -domain example.com or plesk bin protdir -r Protected_Dir -domain example.com |
|
|
Displays help on the use of the utility. |
To see help on the use of the protdir utility: plesk bin protdir --help or plesk bin protdir -h |
Options
Option | Parameter | Description | Example |
---|---|---|---|
|
|
Specifies the name of a domain to which a password-protected directory belongs. Used with all commands, except the |
To create the plesk bin protdir -c Protected_Dir -domain example.com -type nonssl |
|
|
Specifies the name of the subdomain to which the password-protected directory belongs. |
To create the plesk bin protdir -c Protected_Dir -domain example.com -subdomain sub -type nonssl |
|
|
Specifies the title for the login dialog box to be displayed when users attempt to access a password-protected directory. |
To set title "This directory is password protected" for the login dialog box to be displayed when users attempt to access password-protected directory plesk bin protdir -u Protected_Dir -domain example.com -title "This directory is password protected" |
|
|
Specifies the location of a password directory in the domain root catalog:
|
To create password-protected directory plesk bin protdir -c Protected/Protected_Dir -domain example.com -type nonssl |
|
|
Specifies the password for accessing contents of a password-protected directory by a user. See additional comments in the Note below the table. |
To create user JDoe authorized to access contents of password-protected directory plesk bin protdir -u Protected_Dir -domain example.com -add_user JDoe -passwd userpass -passwd_type plain |
|
|
Specifies the type of the password for accessing contents of a password-protected directory by users. |
|
|
|
Creates a password-protected directory user with the specified login name. |
|
|
|
Updates settings of a password-protected directory user with the specified login name. |
To change the user login name for the password-protected directory plesk bin protdir -u Protected_Dir -domain example.com -update_user JDoe -user_name John |
|
|
Sets a password-protected directory user login name. Used in conjunction with the |
|
|
|
Deletes a password-protected directory user with a specified login name. |
To delete the user with the login name JDoe for a password-protected directory plesk bin protdir -u Protected_Dir -type nonssl -domain example.com -remove_user JDoe |
|
|
Sets a new name for a password-protected directory. |
To rename password-protected directory on example.com from plesk bin protdir -u Protected_Dir -domain example.com -dir_name Protected_Archive |
Note: Use of this option is not recommended. Passing passwords through CLI as parameters of the -passwd
option may potentially compromise the system's security as command line can be observed by other users of the system. It is more secure to pass passwords through the environment variables. You can transfer non-encrypted passwords by using environment variable PSA_PASSWORD
while using single quotes to specify the empty values in the command line for the argument of the -passwd
option.
Similarly, you can transfer encrypted passwords through the environment variable PSA_CRYPTED_PASSWORD
while using single quotes to specify the empty values in the command line for the argument of the -passwd
option.