← Back to team overview

relinux-dev team mailing list archive

Re: [Question #210771]: How to assign user name and password in Live CD

 

Question #210771 on relinux changed:
https://answers.launchpad.net/relinux/+question/210771

    Status: Open => Answered

Joel Leclerc proposed the following answer:
There isn't any built-in way to do this (yet), but that doesn't mean you can't do it. Just as a warning, I haven't tested this method yet, but I'm assuming it should work.
Edit /usr/share/initramfs-tools/scripts/casper-bottom/25adduser (it might be 22adduser or 20adduser or something like that, so change the filename accordingly), and scroll down until you see lines like this:

db_set passwd/root-password-crypted '*'
db_set passwd/user-password-crypted U6aMy0wojraho
db_set passwd/user-fullname "$USERFULLNAME"
db_set passwd/username "$USERNAME"
db_set passwd/user-uid 999

Now you have to generate the password hash. Use this command to find it:

openssl passwd -1 pass:koha123

Note that if you run it several times, each time (should) be different.
Don't worry, they all work, this is only because of salting ;). Now
change this line:

db_set passwd/user-password-crypted U6aMy0wojraho

To this (replacing SALTEDPASSWORD to the output of the command):

db_set passwd/user-password-crypted 'SALTEDPASSWORD'

Do not remove the single quotes around SALTEDPASSWORD.
If you want to make sudo ask for the password, change this line:

echo "${USERNAME}  ALL=(ALL) NOPASSWD: ALL" > /root/etc/sudoers.d/casper

To this:

echo "${USERNAME}  ALL=(ALL) ALL" > /root/etc/sudoers.d/casper

Those edits will make it so that the password of the live user will be
changed. If you want the username and password of the installed user to
be preset during the installation, you will have to go into preseeding
Ubiquity. Open /etc/relinux/relinux/preseed/custom.seed and add these
lines (replacing SALTEDPASSWORD to the output of the openssl command):

d-i passwd/user-fullname string User Name
d-i passwd/username string koha
d-i passwd/user-password-crypted password SALTEDPASSWORD


Let me know if this helps :)

-- 
You received this question notification because you are a member of
relinux development team, which is an answer contact for relinux.