How to add non root user in production image

In our gateway, we need to add some non root users when production, for example default user can login in command line interface. We modified /etc/passwd and /etc/shadow to add the user before. Is there any way I can add non root user in ubunto core when production? It needs to run automatically, so sudo adduser --extrausers test will not be acceptable.

Thank you.

you can use a system-user assertion from a usb stick

(that needs to be signed by your brand account that was used to create the model assertion your image was built with)

if you have a brand store

then you also have the ability to pre-install an agent or configuration snap that utilizes the snapd-control interface to talk to snapd via and API

to call the create-user endpoint (helps also to create per-device-users centralized from a central server)