How do I inactivate an account after 14 days without changing a password?

Discussion in 'General Linux' started by red, Dec 1, 2011.

  1. red

    red New Member

    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    0
    I am trying to test some new user policies and I would like test this. I just need to know how to set it up so that after 14 days go by without changing your password, your account is permanently disabled.

    This change would apply to all current and new users.

  2. steelmanronald06

    steelmanronald06 Administrator Staff Member Staff Writer

    Messages:
    32
    Likes Received:
    12
    Trophy Points:
    8
    Look at useradd -e
  3. red

    red New Member

    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    0
    that's for expiring an account after a certain date. I want to set up a new policy that expires accounts that haven't changed their password 14 days after they're supposed to.
  4. Phoenix

    Phoenix New Member

    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    useradd -f

    or...

    check /etc/shadow and on the 3rd field, there's a day count of how many days since Jan. 1, 1970 has come as of today. You can do a bit of math and check the dates the user has registered in a manner to minus it from Jan. 1, 1970. Then add 14 and if the 2nd field hasn't changed, then you could use an if in a cron script.
  5. Victor Leigh

    Victor Leigh Member

    Messages:
    209
    Likes Received:
    8
    Trophy Points:
    18
    Just curious. What's the objective of doing this? Wouldn't this shut out a lot of users?
  6. red

    red New Member

    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    0
    the command I was looking for was chage -I

    The reason for this is that if an account is inactive for that amount of time, without me being notified as to why they're gong that long, I think there's something wrong and I do not want them having access to my systems.

Share This Page