How to assign user name and password in Live CD

Asked by Vimal

I am preparing a live cd for Koha Open Source Library managment system.
I installed Ubuntu 12.04 and login name is koha and password is koha123.
My plan is to make live cd with the help of Relinux.
Can Relinux can retain the user name and password I created in final Live CD.
Same like Remastersys bakcup mode. But I dont want to save other files in Live CD.

I expect a wise advise on this matter

Question information

Language:
English Edit question
Status:
Answered
For:
relinux Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Anonymous Meerkat (lkjoel) said :
#1

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 :)

Revision history for this message
Vimal (vimal0212) said :
#2

I am trying to apply your solution. I will inform you the result soon. I am not a Linux expert, so it take little time. Thank you again.

Can you help with this problem?

Provide an answer of your own, or ask Vimal for more information if necessary.

To post a message you must log in.