December 18, 2015

Managing(adding/deleting,etc) users in a squashfs(RO file system) with a small R/W partition

I'm using squashfs as the file system on a board which is RO, along with a small jffs2 partition which is R/W. The files corresponding to user management, i.e /etc/passwd, /etc/group & /etc/shadow are all located on the RO partition. Now, there's no way a user may add, delete or modify his credentials using commands such as useradd, usermod,etc. I'm looking for a way to provide user management options in this system (maybe by using the jffs2 partion?). I'm aware of 2 possible solutions:

1.Move the etc/{passwd,group,shadow} files to the R/W partition & symlink them to the RO partion.
2.Bind mount these files with their respective copies in on the R/W partion.
The problem with solution 1 is that commands like useradd don't accept symlinks & even if they do(by modifying their source) I'm not sure how either solution will be able to edit the /home/{username} directory while adding/deleting/modifying the home directory name as it's RO.

Squashfs is commonly used for small & embedded systems, so what exactly is the solution that is preferred for such scenarios?

Click Here!