[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Is it possible to create multiple users?



Milou wrote:

> everything is in the title, I want to create two different users on my
> live-cd, but I don't find how to do that...

The functionality is not "built-in", however it is quite easy to achieve.
What you must keep in mind is that the live users are created on startup
by live-initramfs and not when building the image.

To this end, we add a custom initramfs hook:

 $ DIR="config/chroot_local-includes/usr/share/initramfs-tools/scripts/live-bottom"
 $ mkdir -p $DIR
 $ cat > $DIR/90moreusers << EOF
 #!/bin/sh
 chroot /root adduser -q user2 --disabled-password --gecos ''
 echo "user2:password" | chroot /root chpasswd
 EOF
 $ chmod +x $DIR/90moreusers

We also need to refresh the initramfs:

 $ cat > config/chroot_local-hooks/99refresh-initramfs << EOF
 #!/bin/sh
 update-initramfs -u -k all
 EOF

Then build using lh_build as normal. See the chpasswd manpage for details on
how to use encrypted passwords here.


Regards,

-- 
Chris Lamb, UK                                       chris@chris-lamb.co.uk
                                                            GPG: 0x634F9A20

Attachment: signature.asc
Description: PGP signature


Reply to: