---
schema_version: "1"
id: 2321e7e5943d9932d597d544ed18e7e5cc06620ef6d07a7c6d7057ad72159b8a
title: Enable and Disable Lightning Web Security in Scratch Orgs
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/lwc/lightning-components-security/guides/lws/lws-enable-scratch-orgs.md
canonical_url: https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-enable-scratch-orgs.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: d3e2fdab76ac1c6aa4cf2a17e530dd742f633c09a8a1dfa56edb3a6000454b17
products:
  - Security for Lightning Components
  - lwc
---
# Enable and Disable Lightning Web Security in Scratch Orgs

New orgs have Lightning Web Security (LWS) for Lightning web components and Aura components enabled by default. New scratch orgs also have LWS enabled.

To enable and disable LWS in your scratch orgs, you can use [scratch org definition files](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file.htm). For example, to disable LWS in your scratch org, set the `lockerServiceNext` setting to `false`.

```json
"settings": {
     "securitySettings": {
         "sessionSettings": {
            "lockerServiceNext": false
           }
      }
}
```

**important:** The boolean `lockerServiceNext` enables and disables LWS, not [Lightning Locker](https://developer.salesforce.com/docs/platform/lightning-components-security/locker/locker-intro.md).

When LWS is disabled in your scratch org, Lightning Locker is automatically enabled for Lightning web components and Aura components.

**See Also**

- [Salesforce CLI Command Reference](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/)
- [Salesforce DX Developer Guide: Scratch Orgs](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs.htm)
