LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pwqcheck

Validate password strength against policy

TLDR

Check password strength
$ echo "[password]" | pwqcheck
copy
Check with old password
$ pwqcheck -1 [old_password] [new_password]
copy
Check from stdin
$ pwqcheck < [password_file]
copy
Custom config
$ pwqcheck config=[/path/to/pwquality.conf]
copy

SYNOPSIS

pwqcheck [options] [checkparams_]

DESCRIPTION

pwqcheck checks password quality according to configurable rules. It's part of passwdqc for enforcing password policies.Returns OK or an error message describing the weakness.

PARAMETERS

-1

Read old password, new password on stdin.
-2
Read new password only.
config=file
Use specified config file.
min=n
Minimum password length.
max=n
Maximum password length.

EXAMPLES

$ # Check single password
echo "mypassword" | pwqcheck

# With old password (change validation)
echo -e "oldpass\nnewpass" | pwqcheck -1

# Custom policy
echo "Test123!" | pwqcheck min=8 max=40

# In script
if echo "$password" | pwqcheck > /dev/null 2>&1; then
    echo "Password OK"
fi
copy

ERROR MESSAGES

$ Bad passphrase (too short)
Bad passphrase (not enough classes)
Bad passphrase (based on dictionary word)
Bad passphrase (too similar to old)
copy

INSTALL

sudo apt install passwdqc
copy
sudo dnf install passwdqc
copy
sudo zypper install passwdqc
copy
brew install passwdqc
copy
nix profile install nixpkgs#passwdqc
copy

CAVEATS

Part of passwdqc package. Different from pwquality/pam_pwquality. Check return code for validation.

HISTORY

pwqcheck is part of passwdqc by Solar Designer, providing proactive password quality checking.

SEE ALSO

pwqgen(1), passwd(1)

Copied to clipboard
Kai