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

[PATCH] live-initramfs: Assign user password from boot paremeter



Hi,
I have sent this before, but the patch file I sent was not good, so I
think it's why not being accepted. Therefore I patch that based on
live-initramfs 1.157.2 and send it again. Hope you do not mind.
Attached files are the patches to make live-initramfs to allow assigning
user password from boot parameter.
E.g. With this patch, if we want to assign the password of account
"user" as  "newpasswd",  we can run:
echo newpasswd | mkpasswd -s
and got: "T29nBwo26xTzs"
(//NOTE// This results will change every time you run mkpasswd)
then we can assign "usercrypted=T29nBwo26xTzs" in the boot parameter.

I found this is very useful to me to change the default password "live".
Hope this helps.

Steven.

-- 
Steven Shiau <steven _at_ nchc org tw> <steven _at_ stevenshiau org>
National Center for High-performance Computing, Taiwan.
http://www.nchc.org.tw
Public Key Server PGP Key ID: 1024D/9762755A
Fingerprint: A2A1 08B7 C22C 3D06 34DB  F4BC 08B3 E3D7 9762 755A


--- live.orig	2009-05-28 10:06:17.000000000 +0800
+++ live	2009-05-28 10:08:58.000000000 +0800
@@ -98,6 +98,12 @@
 				export USERNAME LIVECONF
 				;;
 
+			usercrypted=*)
+				USERCRYPTED="${ARGUMENT#usercrypted=}"
+				LIVECONF="changed"
+				export USERCRYPTED LIVECONF
+				;;
+
 			userfullname=*)
 				USERFULLNAME="${ARGUMENT#userfullname=}"
 				LIVECONF="changed"
--- 10adduser.orig	2009-05-14 16:16:21.000000000 +0800
+++ 10adduser	2009-05-28 10:10:00.000000000 +0800
@@ -31,7 +31,12 @@
 
 # live-initramfs script
 
-user_crypted="8Ab05sVQ4LLps" # as in $(echo "live" | mkpasswd -s)
+if [ -z "${USERCRYPTED}" ]
+then
+  user_crypted="8Ab05sVQ4LLps" # as in $(echo "live" | mkpasswd -s)
+else
+  user_crypted="${USERCRYPTED}"
+fi
 
 # U6aMy0wojraho is just a blank password
 chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF

Reply to: