• Skip to main content
  • Skip to primary sidebar

Technipages

Tutorials and fixes for smartphone, gadget, and computer problems

  • Topics
    • Android
    • Browsers
    • Gaming
    • Hardware
    • Internet
    • iPhone
    • Linux
    • macOS
    • Office
    • Reviews
    • Software
    • Windows
    • Definitions
  • Product Reviews
  • Downloads
  • About
Linux Passwords: How to Set a Password to Expire

Linux Passwords: How to Set a Password to Expire

November 30, 2022 by Mel Hawthorne Leave a Comment

One of the things you may have to do if you manage a Linux environment is to ensure that the passwords for user accounts are configured securely. One of the things you may be required to set is a maximum password age. This forces the user to reset their password when the timer expires.

Historically the advice was to reset passwords regularly, generally every 90 days. This advice was designed to restrict the timeframe in which a potentially compromised password could be used. More recently though the advice from government agencies such as NIST and the NCSC, as well as the larger cybersecurity community, has changed to recommend that passwords are never routinely expired.

Research has shown that requiring users to regularly change their passwords applies significant pressure towards users picking weaker and formulaic passwords that are easy to guess. This effect is so prevalent that it actually decreases overall security rather than providing the intended benefit. To resolve this issue, security advice has been changed to only require changing passwords when there is a reasonable suspicion that they have been compromised. By not forcing users to regularly remember a new password, they’re significantly more likely to choose a longer and more secure password in the first place, increasing security.

Unfortunately, many companies, standards, and governments are slow to change their policies even when research and government advice recommends that they do. this means you may still occasionally need to set a password expiry time.

How to set a password to expire

To change the expiry time for passwords on a user account, you need to use the “passwd” command with the “-x” flag. The command will need to be run with sudo as it requires root permissions.

To set a password expiry period of 90 days, the command would be “sudo passwd -x90 [username]”. The number of days you want passwords to be valid for should be listed directly after the “-x” flag, with no spaces.

Note: This command will set the current password to expire 90 days after it was last changed, not 90 days from you running the command. If a user’s password was changed more than 90 days ago they will be required to change it the next time that they log in.

If you’re in a position to remove the password reset requirement, you can remove the maximum age of a password by setting it to 99999 days, with the command “sudo passwd -x99999 [username]”.

 

The command sets the number of days for which the specified user’s passwords will be valid before expiring.

You Might Also Like

  • Linux Passwords: How To Force a User To Reset Their Password
    Linux Passwords: How To Force a User To Reset Their Password
  • Linux Passwords: How to Review a User’s Settings
    Linux Passwords: How to Review a User’s Settings
  • Linux Mint: How to Change Your Password
    Linux Mint: How to Change Your Password
  • Linux: How to Configure the Default Password Aging Settings for New Accounts
    Linux: How to Configure the Default Password Aging Settings…
  • Your Organization’s Policy Requires This Link to Expire
    Your Organization’s Policy Requires This Link to Expire
  • How to Fix LastPass Not Saving Passwords
    How to Fix LastPass Not Saving Passwords

Filed Under: Internet

Reader Interactions

Did this help? Let us know!

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Recent Posts

  • How to Make a Drop-Down List in Excel: 2 Best Methods in 2023
  • Can You Mix RAM Brands: A Guide for RAM Mix and Match
  • Google Photos: How to Recover Erased Pictures
  • New Galaxy S23: Full Specs, Features, and More
  • How to Block Calls on Android
  • Mimecast for Outlook: Everything You Need to Know
  • What Is PoE?
  • Excel Calendar Template 2023: The 9 Best Sources You Must Know

Who’s Behind Technipages?

Baby and Daddy My name is Mitch Bartlett. I've been working in technology for over 20 years in a wide range of tech jobs from Tech Support to Software Testing. I started this site as a technical guide for myself and it has grown into what I hope is a useful reference for all.

You May Also Like

  • Linux
  • One-Time Password

© Copyright 2023 Guiding Tech Media · All Rights Reserved · Privacy