Skip to main content

Linux Password Policy

This article explains how the Linux Password Policy works in Swif, how password entropy is enforced, and what each setting in the policy does.


What the Linux Password Policy does

The Linux Password Policy in Swif lets you define and enforce password rules on Linux devices.

  • Supported platform: Linux

  • Device types: Supports both company‑owned and BYOD Linux devices

  • Where it’s enforced:

    • Command‑line password tools (for example, passwd, chpasswd)

    • PAM‑based password change flows configured by Swif

  • Known limitation:

    • Does not work in some desktop environments’ GUI dialogs (for example, KDE password change UI). Enforcement is applied at the system/PAM level.

This policy is designed to align with enterprise best practices and customer requirements such as Navarik’s request to meet minimum password entropy guidance from Apache Infra.


Policy settings and what they control

The following sections describe each setting in the Linux Password Policy using the display names shown in the Swif admin UI.

Minimum Length

  • Type: Number

  • Default: 8

  • Range: 0–20

Defines the minimum number of characters a password must have.

Recommendation: Use at least 12 characters, especially for admin or high‑risk accounts.


Min Digits

  • Type: Number

  • Default: 1

  • Range: 0–20

Sets the minimum number of numeric characters (0–9) required in each password.


Min Upper Case

  • Type: Number

  • Default: 1

  • Range: 0–20

Sets the minimum number of uppercase letters (A–Z) required in the password.


Min Lower Case

  • Type: Number

  • Default: 1

  • Range: 0–20

Sets the minimum number of lowercase letters (a–z) required in the password.


Min Special Characters

  • Type: Number

  • Default: 1

  • Range: 0–20

Sets the minimum number of special characters required.
Examples include: ! @ # $ % ^ & * ( ) _ + and other non‑alphanumeric characters.

Requiring at least one special character significantly increases password complexity.


Min Different Characters from Previous Password

  • Type: Number

  • Range: 0–20

Defines how many character positions must be different from the previous password.

Example:
If this is set to 4, the user’s new password must differ from the old one in at least four character positions, preventing very small changes like appending 1 to an old password.


Minimum Character Classes

  • Type: Number

  • Range: 1–4

Defines how many different character groups must appear in a password. Character classes are:

  1. Lowercase letters

  2. Uppercase letters

  3. Digits

  4. Special characters

Example:
If set to 3, the password must contain characters from at least three of these four groups (for example, lowercase + uppercase + digits).


Max Consecutive Repeat

  • Type: Number

  • Range: 0–20

Limits how many times the same character can appear in a row.

Example:

  • If set to 2:

    • aa or 11 is allowed.

    • aaa or 111 is not allowed.

This helps avoid weak patterns like long sequences of the same character.


Max Class Repeat

  • Type: Number

  • Range: 0–20

Limits how many characters from the same character class can appear consecutively.

Example:

  • If set to 3, a password like abcd (4 lowercase letters in a row) might be blocked until the user mixes in another class such as a digit or symbol (for example, abc1d).

This prevents long runs of the same type of character and encourages mixed‑type passwords.


Check GECOS

  • Type: On/Off

When turned on, Swif checks the password against the user’s personal information stored in GECOS fields (for example, full name, contact info).

If the password contains straightforward pieces of this personal information, it can be rejected. This prevents easily guessable passwords like including your first or last name.


Check Dictionary

  • Type: On/Off

When turned on, passwords are checked against a dictionary file of disallowed words (for example, common or weak passwords such as password, qwerty, letmein).

If this option is enabled, you will see an additional setting:

Dictionary Path

  • Type: Text

  • Default: /usr/share/dict/words

Specifies the file path to the dictionary that Swif uses when checking passwords. You can provide a custom dictionary that contains:

  • Frequently used weak passwords

  • Organization‑specific banned words (such as company name or products)


Check Username

  • Type: On/Off

When turned on, passwords are checked to ensure they do not contain the username.

Often combined with Username Substring to fine‑tune how strict this check is.


Username Substring

  • Type: Number

  • Minimum: 0

Defines the length of username substrings to look for inside the password.

Example:

  • Username: navarik-admin

  • Username Substring: 3

Swif will check every 3‑character segment (nav, ava, var, ari, and so on) and can reject passwords that contain them, making it harder to build passwords directly from the username.


Retry Limit

  • Type: Number

  • Minimum: 1

Sets the maximum number of failed attempts allowed before an account is locked, according to your PAM and lockout configuration.

Typical practice: 3–5 retries to protect against brute‑force attempts while remaining reasonable for users.


Enforce for Root Users

  • Type: On/Off

Controls whether all the above password rules (length, complexity, entropy‑related checks, etc.) are also enforced for root users.

Recommendation: Turn this on in most environments to make sure highly privileged accounts meet your strongest standards.


Password aging settings

These settings control how long passwords are valid and when users are warned to change them.

Maximum Days

  • Type: Number of days

  • Default: 180

  • Range: 5–365

Specifies the maximum number of days a password can be used before the user is required to change it.

  • Common values:

    • 90 days for stricter policies

    • 180 days for a balanced approach


Minimum Days

  • Type: Number of days

  • Range: 0–365

Defines the minimum number of days that must pass before a user is allowed to change their password again.

This prevents users from quickly cycling through multiple password changes to get back to an older password.


Warn Age Days

  • Type: Number of days

  • Range: 0–365

Defines how many days before expiry users are warned about their upcoming password expiration.

Example:

  • If Maximum Days is 180 and Warn Age Days is 14:

    • Users start receiving warnings 14 days before the 180‑day expiration point.


Apply Password Aging to Root User

  • Type: On/Off

Controls whether Maximum Days, Minimum Days, and Warn Age Days also apply to the root user.

  • Turn this on when root login is used directly.

  • In environments where root is not used directly (for example, sudo only), this can still be enabled for consistency.


Remembering previous passwords

Remember Previous Passwords

  • Type: On/Off

Enables password history so users cannot reuse a number of their previous passwords.

If this option is enabled, an additional setting appears:

Number of Remembered Passwords

  • Type: Number

  • Range: 0–10

Defines how many of the user’s last passwords are remembered and blocked from reuse.

Example:

  • If set to 5, users cannot reuse any of their last five passwords.


How enforcement works on Linux

When a user changes a password on a Linux device managed by Swif:

  1. Swif checks if a Linux Password Policy is assigned to that device or identity.

  2. The new password is checked against:

    • Minimum Length

    • Min Digits, Min Upper Case, Min Lower Case, Min Special Characters

    • Minimum Character Classes

    • Max Consecutive Repeat and Max Class Repeat

    • Check GECOS, Check Dictionary (and Dictionary Path), Check Username, Username Substring

    • Retry Limit and Remember Previous Passwords / Number of Remembered Passwords

    • Maximum Days, Minimum Days, Warn Age Days, and the Apply Password Aging to Root User and Enforce for Root Users settings where relevant

  3. If any requirement fails, the password change is rejected, and the user must choose a stronger password.


Recommended baseline configuration

To align with common enterprise and Apache Infra‑style guidance, consider the following starting point:

  • Minimum Length: 12 or higher

  • Min Digits / Min Upper Case / Min Lower Case / Min Special Characters: at least 1 each

  • Minimum Character Classes: 3 or 4

  • Check GECOS: On

  • Check Dictionary: On, with a curated dictionary

  • Check Username + Username Substring: On, with a substring length such as 3–4

  • Max Consecutive Repeat / Max Class Repeat: 2–3

  • Retry Limit: 3–5

  • Remember Previous Passwords: On, with Number of Remembered Passwords set to 5 or more

  • Enforce for Root Users / Apply Password Aging to Root User: On

  • Maximum Days: 90–180

  • Warn Age Days: 7–14

Did this answer your question?