I needed to implement a multi-user environment with persistent user data across reboots. In addition, I needed to preserve UIDs across my net booted TinyCore system and my NFS system. I originally started by remastering with an updated /etc/passwd, /etc/shadow, /etc/group, and /etc/sudoers but decided that something more generic would be helpful... hopefully this is helpful to others as well.
I assume you know how to extract and repackage (aka Remaster) TinyCoreLinux... if not, check out the wiki:
http://wiki.tinycorelinux.net/wiki:remastering1. extract the current tree from core.gz (I used version 4.7.6)
2. apply the attached patch file
cd /my_temp_extracted_tree_root_directory/etc/init.d
cp tc-config tc-config_ORIGINAL (make a backup copy, just in case)
patch -i tc-config-path
3. remaster the changed tree
4. boot from the remastered image with additional user and uid boot code options
e.g. user=bob uid=1024
5. once the system boots, you should see that you are user "bob" with uid of 1024
~$ whoami
bob
~$ id
uid=1024(bob) gid=50(staff) groups=50(staff)
6. At this point, to make your "bob" user account persistent, you need to back up some user related files. The easiest way is to add this to your mydata.tgz... I assume you have persistence working.
~$ sudo vi /opt/.filetool.lst
ADD THE FOLLOWING LINES to your .filetool.lst
etc/passwd
etc/shadow
etc/group
etc/sudoers
Now, force a backup
~$ filetool.sh -b
7. DONE -- you should now be able to reboot, and re-use the bob user account with uid 1024. You need to still provide the boot codes (user=bob uid=1024).
The patch added the new boot code "uid=XXX" which is optional, but when specified tries to set the uid of the user. This boot code is only effective when the "user=" is also present. The values for uid must be greater than 999 and less than 65534.
The patch also added a new boot code "NOPERSISTENTUSER" which can be used to restore the boot time user information (from the core.gz image) by overwriting any restored user information.
Though I outlined how to use these changes with mydata.tgz, one could also configure a system which uses shutdown.sh (and bootsync.sh) to persist the user information. Beware of restoring the /etc/sudoers file as you will need sudo cp the saved files back into the running file system but sudo may fail if the file is being overwritten.... I can't recall the details so I leave that up to another brave soul to test and report back. Regardless, the changes in my patch should handle the restoration occurring from either mydata.tgz or from bootsync.sh (or even bootlocal.sh).