Sub topic 7
Setting password policies
Password policies set the rules for the first factor of a Salesforce login: length, complexity, age, history, and lockout. This chapter assumes you can navigate Setup, know how profiles and permission sets differ, and know what the earlier chapters covered about login threats and MFA. A password policy does not replace MFA. It makes the password half of the login harder to guess, reuse, or brute-force.
What a password policy controls
Password policies live in Setup under Security > Password Policies. They apply to every user in the org unless a profile overrides them. These are the main settings:
| Setting | Options | Default |
|---|---|---|
| User passwords expire in | 30, 60, 90 days, 6 months, 1 year, never expires | 90 days |
| Enforce password history | 1 to 24 remembered passwords, or none | 3 |
| Minimum password length | 5 to 50 characters | 8 |
| Password complexity requirement | No restriction, or combinations of letters, numbers, uppercase, lowercase, and special characters | Mix of letters and numbers |
| Password question requirement | Cannot contain the password, or none | None |
| Maximum invalid login attempts | 3, 5, 10, or no limit | 10 |
| Lockout effective period | 15, 30, 60 minutes, or always | 15 minutes |
| Require a minimum 1 day password lifetime | On or off | Off |
| Obscure secret answer for password resets | On or off | Off |
Defaults can differ between older and newer orgs, so check the values in your own org before you assume them.
Length versus complexity
Length adds more strength than complexity rules do. A 14-character passphrase of ordinary words is harder to brute-force than an 8-character string with a symbol. It is also easier to remember. Complexity rules push users toward predictable patterns such as Summer2026!. A good starting point is a length of at least 12, a moderate complexity rule (letters and numbers, or mixed case plus numbers), and a message that encourages passphrases.
Expiration and history
Forced expiration protects you if a password leaked and nobody noticed. It also pushes users to make small edits like Password1 to Password2. Two settings limit that behavior:
- Enforce password history blocks reuse of recent passwords.
- Require a minimum 1 day password lifetime stops a user from changing the password several times in a row to cycle back to an old one.
If you require MFA for every login, many organizations lengthen the expiration period or remove it. Check your security policy and any compliance rules first.
Lockout
Lockout limits online guessing. After the configured number of failed attempts, the account is locked for the lockout period. If you choose Always, an administrator must unlock the user. That setting is stricter, and it also lets an attacker lock out real users on purpose by entering wrong passwords. For most orgs, 5 attempts with a 15 or 30 minute lockout balances the two risks.
Configuring org-wide policies
- In Setup, enter Password Policies in Quick Find and open the page.
- Set the expiration, history, length, and complexity values.
- Set the maximum invalid login attempts and the lockout period.
- Choose whether to obscure the secret answer for password resets.
- Save.
New rules take effect when a user next sets a password. Existing passwords are not checked against the new length or complexity. If you need them to comply now, use Setup > Users > Expire All Passwords. Each user then has to choose a new password at the next login. Do this outside business hours, and tell users first. It will also disrupt integrations that sign in with a username and password.
Overriding policies by profile
Each profile has its own Password Policies section. You can set a different expiration period, minimum length, complexity requirement, and lockout behavior for the users in that profile. A profile policy that is stricter than the org-wide policy applies to those users. A looser one can also apply, so review profile overrides regularly. The org-wide page does not show them.
A common design:
- Standard employees use the org-wide policy.
- Administrators, and anyone with the Modify All Data permission, get a longer minimum length, a shorter lockout threshold, and a stricter expiration.
- Integration users get a profile where the password does not expire (see below).
Give any profile override a clear reason. Every exception makes the policy harder to audit.
Password Never Expires
The Password Never Expires user permission exempts a user from expiration. You can grant it through a profile or a permission set. Use it for integration users that cannot change their password interactively. Do not use it for people. Where possible, replace the stored password with an OAuth-based connection, so the integration has no password to expire or leak.
Resetting passwords and unlocking users
Administrators with the Reset User Passwords and Unlock Users permission can do the following from a user's detail page:
- Reset the password, which sends the user an email with a reset link.
- Unlock the user, if the account is locked.
- Set a password directly, using Expire Password or the reset option. Avoid this where possible, because the administrator then knows the password.
A password reset also resets the user's security token. Any API client that uses the password plus the token must be updated.
Users can also reset their own password from the login page, through Forgot Your Password? The user receives an email at the address on the user record. If you have turned on Obscure secret answer for password resets, the answer field is masked as the user types. Keep user email addresses correct and protect mailboxes with MFA. A reset email in an attacker's hands is an account takeover.
Checking the effect of your policy
You can check how often users hit the lockout rule by querying login history. Failed attempts appear with a status other than Success. A lockout shows up with its own status value.
SELECT UserId, LoginTime, SourceIp, Status, Application
FROM LoginHistory
WHERE LoginTime = LAST_N_DAYS:7
AND Status != 'Success'
ORDER BY LoginTime DESC
LIMIT 200Look for these patterns:
- Many failures for one user from different IP addresses suggest a password-guessing attack. Tighten lockout and review that user.
- Many users failing from one IP address suggest password spraying, where an attacker tries a few common passwords against many accounts.
- Repeated failures from an integration user usually mean an expired password or a changed security token, not an attack.
Common errors
- Setting the lockout period to Always without an unlock process. Users get locked out by mistake and need an administrator every time. Decide who unlocks accounts and how users prove who they are.
- Treating password length as a complexity rule. They are separate settings. Raise both deliberately.
- Forgetting integration users. Expiration, lockout, and Expire All Passwords all hit service accounts. Give them a separate profile, restricted login IP ranges, and OAuth where available.
- Relying on policies alone. A strong password can still be phished. Pair these rules with MFA, which earlier chapters covered.
- Leaving old profile overrides in place. A profile with a 5-character minimum and no expiration defeats the org-wide policy for everyone on it.
- Changing policies without telling users. A sudden expiry produces a spike of support requests. Announce the change and explain what to do.
Policy design checklist
- Set a minimum length of at least 12 and a moderate complexity rule.
- Keep password history on, and require the minimum 1 day lifetime.
- Choose a lockout threshold (such as 5 attempts) and a period that matches your support capacity.
- Create stricter profile overrides for administrators.
- Put integration users on their own profile, using Password Never Expires only where unavoidable.
- Review failed logins weekly during the first month.
Exercise
A user reports being locked out. Your org allows 5 invalid attempts, with a lockout period of "Always". What are the two ways the user can get back in, and what is the downside of "Always"?
Show answer
The user cannot wait out the lockout, so an administrator with the Reset User Passwords and Unlock Users permission must unlock the account from the user's detail page, and the user then signs in again, or resets the password if they have forgotten it. The downside of "Always" is that every lockout needs an administrator, and an attacker can lock real users out on purpose by entering wrong passwords. A timed lockout of 15 to 30 minutes limits guessing while letting users recover on their own.
Exercise
You raise the minimum password length from 8 to 14 characters. Why do existing users with 9-character passwords keep signing in, and what setting would force them to comply?
Show answer
Password rules are checked only when a user sets a new password, so existing passwords are not re-validated. Using Expire All Passwords in Setup (or a shorter expiration period) makes each user choose a new password that meets the 14-character rule at their next login. Before you do this, list the integration users that sign in with a password and token, because their logins will fail until someone resets them.
Exercise
An integration user keeps failing logins every 90 days. Name two ways to stop this, and say which you would prefer.
Show answer
Give the user a profile or permission set with the Password Never Expires permission, or replace the password-based login with an OAuth connection. OAuth is preferable because there is no password to expire, rotate, or leak, and the Password Never Expires permission is only a workaround for a credential that people can still misuse.