Wednesday, August 26, 2015

How to create an account for a specified amount of days.

How to create an account for a specified amount of days.


You can create an account with user add and specify the expiration date.
# useradd -e 2015-10-31 <newUser>

here,
-e, --expiredate EXPIRE_DATE
     The date ison YYYY-MM-DD format.

or,
you can create an account and use chage or usermod command to change the date.

# useradd <newUser>
# usermod --expiredate $(date -d "30 days" "+%Y-%m-%d") <newUser>

$ echo `date -d "30 days" +"%Y-%m-%d"`

or
# useradd <newUser>
# chage -E 2015-10-31 <newUser>

No comments:

Post a Comment