password expire date removing for linux

2.8k views Asked by At

i have below commands am using it for removing expire date for my user at unix it's working but for linux it's not working below example is for unix if anyone have a linux command like this i'll be thankful

root@servername>passwd -s user
user    PS    05/13/15          84
root@servername>passwd -x -1 user
passwd: password information changed for user

before

username:$md5$Dtj/7tJf$$VY7qJE2us6ODX/2xLUGAS:16568::84::::

after

username:$md5$Dtj/7tJf$$VY7qJE2us6ODX/2xLUGAS:16548::::::
2

There are 2 answers

3
David C. Rankin On

You need the usermod command:

usermod -e -1 $USER

Where -1 serves as the argument to -e.

To remove the expire date.

The expiration date parameter can be empty. (but not missing when the -e option is used) The -e, --expiredate EXPIRE_DATE option is described as follows in man 8 usermod:

An empty EXPIRE_DATE argument will disable the expiration of the account.

The issue being on how you interpret "empty". Both forms, -e or --expiredate= will accept an empty argument. Those being:

  -e ''

or

  --expiredate=

With thanks to @alx

0
Bijan Hoomand On

chage -I -1 -m 0 -M 99999 -E -1 username