Newer Version Available

This content describes an older version of this product. View Latest

Log Out of an Org

For security purposes, you can use the Salesforce CLI to log out of any org you’ve previously authorized. This practice prevents other users from accessing your orgs if you don’t want them to.

The only way to access an org after you log out of it is with a password. By default, new scratch orgs contain one administrator with no password. Therefore, to avoid losing access to a scratch org, set a password for at least one user of a scratch org if you want to access it again after logging out. If you don’t want to access the scratch org again, delete it with org delete scratch rather than log out of it.

Important

To log out of an org, run org logout from a terminal (macOS and Linux) or command prompt (Windows). This example uses the alias my-hub-org to log out.

1sf org logout --target-org my-hub-org

To log out of all your orgs, including scratch orgs, use the --all flag.

1sf org logout --all

To access an org again, other than a scratch org, reauthorize it.

When you log out of an org, it no longer shows up in the org list output. If you log out of a Dev Hub org, the associated scratch orgs show up only if you specify the --all flag.