How to modify the expiration period?

To modify the expiration period for a user account in the script you provided, you can change the number of days added to the current date in the date command. Here’s how to do it:

Example Modification

  1. Change the Number of Days:
    If you want to set the expiration period to, for example, 60 days instead of 30, modify the script like this:

    EXPIRY_DATE=$(date -d "+60 days" +%Y-%m-%d)
    echo "Account will expire on: $EXPIRY_DATE"
    sudo chage -E $EXPIRY_DATE policyuser

Steps to Modify

  • Locate the date command in your script.
  • Change the +30 days to your desired number of days (e.g., +60 days for 60 days).
  • Run the modified script to apply the new expiration period.

Summary

By adjusting the number of days in the date command, you can easily modify the expiration period for the user account. If you need further assistance, feel free to ask!

0 Comments

no data
Be the first to share your comment!