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 |
---|---|---|---|
--create or -c
|
<directory_name> |
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 |
--update or -u
|
<directory_name> |
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" |
--remove or -r
|
<directory_name> |
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 |
--help or -h
|
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 |
---|---|---|---|
-domain |
<domain_name> |
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 |
-subdomain |
<subdomain_name> |
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 |
-title |
<string> |
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" |
-type |
nonssl|ssl|cgi |
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 |
-passwd |
<password> |
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 |
-passwd_type |
plain|encrypted |
Specifies the type of the password for accessing contents of a password-protected directory by users. | |
-add_user |
<login_name> |
Creates a password-protected directory user with the specified login name. | |
-update_user |
<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 |
-user_name |
<login_name> |
Sets a password-protected directory user login name. Used in conjunction with the |
|
-remove_user |
<login_name> |
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 |
-dir_name |
<directory_name> |
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.