• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Customize Linux Password Expiration and Complexity Requirements

by admin

1. Password Expiration

To set the default password expiration when creating new accounts on CentOS/RHEL, edit the /etc/login.defs file.

PASS_MAX_DAYS 100

Which means the maximum number of days a password may be used. Please check man page of login.defs for more options that can be set in /etc/login.defs.:

$ man login.defs

2. Password Complexity

The PAM module pam_cracklib can be used to force password complexity requirements. The complexity can be specified with the following options:

  • Minimum password length (minlen)
  • Minimum number of lower case letters (lcredit)
  • Minimum number of upper case letters (ucredit)
  • Minimum number of numeric characters (dcredit)
  • Minimum number of non-alphanumeric characters (ocredit)

Here is an example line in /etc/pam.d/system-auth:

password    required      /lib/security/$ISA/pam_cracklib.so retry=3 minlen=10 dcredit=-1 ucredit=-1 lcredit=-1 ocredit=-1

Given the above setting, users would be required to choose passwords that are at least 10 characters long, that have at least one lower case character, one uppercase character, one number and one special character. Note that to require any of these characteristics a negative number is specified.

Filed Under: CentOS/RHEL 5, CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL 7 : How to add a kernel parameter only to a specific kernel
  2. How to Limit some User Memory Resources on CentOS/RHEL using cgroup
  3. dockerd: command not found
  4. CentOS / RHEL : How to set up chroot jail SFTP
  5. last Command Examples in Linux
  6. ipcalc: command not found
  7. How to Disable Daylight Savings Time (DST), and Modify the Timezone on Linux
  8. lsof: command not found
  9. Audit Rule Configuration not Reflected – How to troubleshoot
  10. opkg Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright