Build Torizon OS with custom username and password

Every new image of Torizon OS (formerly TorizonCore) has bultin credentials (torizon/torizon) and you’re required to change the password when you login for the first time.
Is there a way to build a custom image of TorizonOS specifying the credentials (so that a change is not needed)?
Thanks

1 Like

Greetings @vix,

After you set the password in Torizon OS, you should be able to capture this with torizoncore-builder. The resulting image when flashed on other devices will then have the password already set.

Best Regards,
Jeremias

Hi @jeremias.tx

this is not our intended usage.
We’ve setup an automatedb CI/CD pipeline to build a customized release of Torizon PS and so we need to set tje credentials in the recipe.

Is there a wya?

We’ve setup an automatedb CI/CD pipeline to build a customized release of Torizon PS and so we need to set tje credentials in the recipe.

I see so you’re doing a full Yocto build then?

In that case if you want to change/add a new user to the OS you need to modify/append on to the following files from our meta-layer:

You can see in each file where the torizon user gets set.

If you want to change the password you want to modify this specific line: https://github.com/toradex/meta-toradex-torizon/blob/kirkstone-6.x.y/recipes-core/torizon-users/torizon-users_1.0.bb#L18

USERADD_PARAM:${PN} = "-G adm,sudo,users,plugdev,audio,video,gpio,i2cdev,spidev,dialout,input,pwm -m -d /home/torizon -p GudJRR5U.mLp2 torizon"

The password is this part specifically -p GudJRR5U.mLp2 this is basically the same behavior as the useradd command. This expects an encrypted version of the password. As seen by the comment above this line you can generate such with openssl passwd <password>.

Finally, if you want to remove/prevent the behavior that forces a password change on first login you need to remove this function: https://github.com/toradex/meta-toradex-torizon/blob/kirkstone-6.x.y/recipes-core/torizon-users/torizon-users_1.0.bb#L20

Alternatively as seen by the function if you add the file /etc/.passwd_changed then this also prevents the password change from occurring.

Best Regards,
Jeremias

1 Like

I see so you’re doing a full Yocto build then?

No. We customized tcbuild.yaml to download Torizon OS Quarterly 6.4.0, changing the splash screen, using a custom device tree, …

No. We customized tcbuild.yaml to download Torizon OS Quarterly 6.4.0, changing the splash screen, using a custom device tree, …

I’m confused then, if you’re using TorizonCore Builder then why did you turn down my initial suggestion?

User and password configurations should be stored in /etc, therefore you can capture these changes with TorizonCore builder. Then these changes can be built into your custom image.

Best Regards,
Jeremias