1

I have an ubuntu linux image, which I use for my single board computer.

When I write it the media (it's an sdcard), then boot and log in, it asks me to change the password.

Since I can mount and modify the sdcard content with another computer before actually performing the boot, I'd like to disable the password expiry.

I know that on a running system I can use chage, but in this case, the target system is on the card.

Is it possible to do it?

2

From man chage:

   -R, --root CHROOT_DIR
       Apply changes in the CHROOT_DIR directory and use the configuration
       files from the CHROOT_DIR directory.

So just chroot to the mount point of your sdcard.

Editing shadow to delete the expiry times bypasses the normal mechanisms. It could in principle fail if shadow is backed by a database, your login reads credential from NIS, and other similar situations, but you probably don't have any of these oddball situations on a sdcard. So editing shadow should work too.

2

The fields are in /etc/shadow. If you look at them in detail man 5 shadow

The easiest way to set an account to have no password aging controls is just to remove all that data

eg

username:encrstring:changedday::::::

Some systems use 99,999 days as the effective password expiration

eg

username:encrstring:changedday:0:99999:7:::

In both cases you should not be asked to change the password on next login.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.