Networking-Forums.com

Professional Discussions => Programming Goodies and Software-Defined Networking => Topic started by: nikolaymartin on June 08, 2020, 09:26:12 AM

Title: Add New User with Specific Expire Date
Post by: nikolaymartin on June 08, 2020, 09:26:12 AM
I want to add a user account to my linuxbox. But this user will have specific expire time which will be specified at the useradd definition.
Title: Re: Add New User with Specific Expire Date
Post by: deanwebb on June 08, 2020, 10:03:03 AM
Hey, good to hear from you again. You hadn't been around in a while, I was getting worried you'd been deleted or blocked as a spammer. :smug:

OK, so a temporary user... this is cool... I'll look that up...

https://unix.stackexchange.com/questions/80968/how-can-i-create-automatically-expiring-user-accounts <-- first search result, betcha it's got the goods!

and daaaaaaaaaaaaaamn, they quote the man page!

-e, --expiredate EXPIRE_DATE
     The date on which the user account will be disabled. The date is
     specified in the format YYYY-MM-DD.

     If not specified, useradd will use the default expiry date specified
     by the EXPIRE variable in /etc/default/useradd, or an empty string
     (no expiry) by default.

To figure out the date in the future, date -d can give that info.

Title: Re: Add New User with Specific Expire Date
Post by: Otanx on June 08, 2020, 10:47:52 AM
Less than 30 minutes from question asked to answered. Faster than most TACs.

-Otanx
Title: Re: Add New User with Specific Expire Date
Post by: deanwebb on June 08, 2020, 11:57:18 AM
Quote from: Otanx on June 08, 2020, 10:47:52 AM
Less than 30 minutes from question asked to answered. Faster than most TACs.

-Otanx


:badass:

We got us a pretty decent SLA around here, for a bunch of volunteers. :smug:
Title: Re: Add New User with Specific Expire Date
Post by: Otanx on June 08, 2020, 05:18:59 PM
If we break SLA you get your money back.

-Otanx
Title: Re: Add New User with Specific Expire Date
Post by: deanwebb on June 09, 2020, 10:58:55 AM
That other bot responder is taking its sweet time in getting back to us, wonder if they're maxing out on CPU...