Skip to content
LogoTechnipages
LogoTechnipages
  • Topics
        • Android
        • Browsers
        • Gaming
        • Hardware
        • Internet
        • iPhone
        • Linux
        • macOS
        • Office
        • Reviews
        • Software
        • Windows
        • Definitions
        • All Recent Posts
  • Product Reviews
  • About

Linux Passwords: How to Set a Password to Expire

Mel HawthorneNovember 30, 2022 Comments (0)

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.

Categories: Internet

Author Mel Hawthorne

You Might Also Like

  • Fix Google Chrome Status_Invalid_Image_Hash Error

    Madalina DinitaInternet
  • How to Add a Friend in Discord

    Mel HawthorneInternet
  • What Is SQL Injection?

    Mel HawthorneInternet
  • How to Cancel Your Google One Membership

    Judy SanhzInternet

Leave a Reply

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.

How to Enable Dark Mode on WhatsApp Updated Methods for 2023

How to Send HD Pictures and Videos on WhatsApp

How to Share Files Using Google Nearby Share

How to Share Files Using Google Nearby Share

Android Battery Will Not Charge Fix

Android Battery Will Not Charge Fix

Turning on Triple Touch Zoom on Android

Turning on Triple Touch Zoom on Android

How to Connect Outlook 2023 to Gmail

How to Connect Outlook 2023 to Gmail

profile pic

The Experts Behind Technipages

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.

Learn More

technipages logo white
linkedin icon

Technipages is part of Guiding Tech Media, a leading digital media publisher focused on helping people figure out technology. Learn more about our mission and team here.

© 2023 Guiding Tech Media All Rights Reserved

  • About Us
  • Contact
  • Legal & Privacy

© 2023 Guiding Tech Media All Rights Reserved

Information from your device can be used to personalize your ad experience.
Do not sell my personal information.