I need to set up an account inactivity expiration date (es. 1 year).

As shown in some tutorials, a way of doing so is to use the usermod command.

Due to some constraints, I need to do so offline, modifying some configuration file before running my embedded (poky) distro.

What changes in which configuration file should I apply to have the same effects of such usermod command?

1 Answer 1


this is set in 8th field in /etc/shadow (see man 5 shadow).

account expiration date

The date of expiration of the account, expressed as the number of days since Jan 1, 1970 00:00 UTC.

Note that an account expiration differs from a password expiration. In case of an account expiration, the user shall not be allowed to login. In case of a password expiration, the user is not allowed to login using her password.

An empty field means that the account will never expire.

You can compute expiration date using expr $(date +%s ) / 86400 which will give you number of days since 1/1/1970, then adding whatever days you want.

Note that this will disable user loging after expiration date (as explained above), but will not kill/disable any running unix process.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .