Knowledgebase

How to set Security Policy in Plesk via CLI?

In Plesk, you can set the security policy using the plesk bin command-line utility. The security policy defines a set of rules and recommendations for securing websites and web applications.

Here's how you can set the security policy in Plesk via the command line:

  1. Open a Command Line Interface:

    • Access the command line interface of your server. This could be via SSH or a terminal window if you're logged in directly.
  2. Use the plesk bin Command:

    The command to set the security policy is:

    bash
    plesk bin security --set --security-policies <policy>

    Replace <policy> with the desired security policy. Plesk typically provides a list of predefined security policies that you can choose from.

  3. Example:

    For example, if you want to set the "Maximum" security policy, you would use:

    bash
    plesk bin security --set --security-policies Maximum
  4. View Current Security Policy:

    You can view the currently set security policy using the following command:

    bash
    plesk bin security --status

    This will display the current security policy and whether it's enabled or not.

  5. Apply the Policy to a Specific Subscription or Domain (Optional):

    If you want to apply the security policy to a specific subscription or domain, you can use the --subscription-name or --domain-name options. For example:

    bash
    plesk bin security --set --security-policies Maximum --subscription-name example.com

    This will apply the "Maximum" security policy to the subscription associated with example.com.

Remember, adjusting the security policy may have implications for the websites hosted on your server, so it's important to carefully consider the policy that best suits your needs. Additionally, always ensure you have a backup of your data before making any significant changes.

  • 0 Users Found This Useful
Was this answer helpful?