Skip to content

Instantly share code, notes, and snippets.

@KnightsWhoSayNi0
Created October 18, 2023 02:23
Show Gist options
  • Save KnightsWhoSayNi0/e0ede89506da5996f110d97a9698da53 to your computer and use it in GitHub Desktop.
Save KnightsWhoSayNi0/e0ede89506da5996f110d97a9698da53 to your computer and use it in GitHub Desktop.
Simple script to edit password policies in linux
#!/bin/bash
FILE="${FILE:-"/etc/login.defs"}"
sed -i "s/^[^#]*PASS_MAX_DAYS.*$/PASS_MAX_DAYS 90/" "${FILE}"
sed -i "s/^[^#]*PASS_MIN_DAYS.*$/PASS_MIN_DAYS 7/" "${FILE}"
sed -i "s/^[^#]*PASS_WARN_AGE.*$/PASS_WARN_AGE 14/" "${FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment