# protdir.exe: Protection on Site Directories

The `protdir.exe` utility serves to manage web protection for domain directories, or, in other words, site areas. The utility allows the following operations:

- creating, renaming, and removing protected web directories
- adding and removing users allowed to access protected web directories
- changing the credentials of the users allowed to access protected web directories

## Location

`%plesk_cli%`

## Usage

    protdir.exe <command> [<dir_name>] [
    <option 1> <param> [<option 2> <param>] ... [<option N> <param>]
    ]

## Example

The following command creates the `ProtectedDir` protected directory on domain example.com, adds the JohnDoe user for this directory, and sets the MyPass password for this user.

    plesk bin protdir.exe --create ProtectedDir -domain example.com -add_user JohnDoe -passwd MyPass

## Commands

Command | Parameter | Description | Example
--- | --- | --- | ---
`--create` or `-c` | `<dir_name>` | Creates the protected URL on the specified domain. Requires `-domain` option. | To create the protected URL ProtectedDir on example.com:
    plesk bin protdir.exe --create ProtectedDir -domain example.com
or
    plesk bin protdir.exe -c ProtectedDir -domain example.com
`--update` or `-u` | `<dir_name>` | Updates the protected URL. Is meant to change URL and manage its users. Requires `-domain` option. | To update ProtectedDir by assigning it a title to be displayed on the dialog box:
    plesk bin protdir.exe --update ProtectedDir -domain example.com -title "Welcome to ProtectedDir"
or
    plesk bin protdir.exe -u Protected_Dir -domain example.com -title "Welcome to ProtectedDir
`--remove` or `-r` | `<dir_name>` | Removes password protection from an URL. Requires `-domain` option. | To remove password protection from the URL ProtectedDir from example.com:
    plesk bin protdir.exe --remove ProtectedDir -domain example.com
or
    plesk bin protdir.exe -r ProtectedDir -domain example.com
`--help` or `-h` |  | Displays help on the use of the utility. | To see the help info on the use of this utility:
    plesk bin protdir.exe --help
or
    plesk bin protdir.exe -h

## Options

Option | Parameter | Description | Example
--- | --- | --- | ---
`-domain` | `<domain name>` | Specifies the domain name that owns the URL. Required for all commands, except for `--help`. | To create the protected URL ProtectedDir on example.com:
    plesk bin protdir.exe --create ProtectedDir -domain example.com
`-subdomain` | `<subdomain name>` | Specifies the subdomain name that owns the URL. | To create the protected URL ProtectedDir on photo.example.com:
    plesk bin protdir.exe --create ProtectedDir -domain example.com -subdomain photo
`-title` | `<string>` | Specifies the realm of the protected URL, i.e. the description that will be displayed in the authorization window. | To create a realm for the protected URL ProtectedDir on example.com:
    plesk bin protdir.exe --update ProtectedDir -domain example.com -title "Welcome to protected directory"
`-passwd` | `<password>` | Specifies the protected URL user password. | To set a password for the ProtectedDir user with the login name JohnDoe to MyPass:
    plesk bin protdir.exe --update ProtectedDir -domain example.com -update_user JohnDoe -passwd MyPass
`-add_user` | `<login_name>` | Adds the protected URL user. | To add ProtectedDir user with the login name JohnDoe and the password MyPass on example.com:
    plesk bin protdir.exe --update ProtectedDir -add_user JohnDoe -domain example.com -passwd MyPass
`-update_user` | `<login_name>` | Updates the protected URL user. | To change the ProtectedDir user’s login name from JohnDoe to John on example.com:
    plesk bin protdir.exe --update ProtectedDir -update_user JohnDoe -user_name John -domain example.com
`-remove_user` | `<login_name>` | Removes protected URL user. | To remove the ProtectedDir user with the login name JohnDoe on the domain example.com:
    plesk bin protdir.exe --update ProtectedDir -remove_user JohnDoe -domain example.com
`-user_name` | `<login_name>` | Sets the login name for a protected URL user. Can be used in combination with the `-update_user` option. | To change the ProtectedDir user’s login name from JohnDoe to John on the domain example.com:
    plesk bin protdir.exe --update ProtectedDir -update_user JohnDoe -user_name John -domain example.com
`-dir_name` | `<dir_name>` | Sets the name of the protected URL. | To rename the protected URL from ProtectedDir to ProtectedPhoto on the domain example.com:
    plesk bin protdir.exe --update ProtectedDir -dir_name ProtectedPhoto -domain example.com
`-passwd_type` | `plain|encrypted` | Sets the password type. | To set the type of password to plain for the protected URL ProtectedDir on example.com:
    plesk bin protdir.exe --update ProtectedDir -domain example.com -passwd_type plain