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

late_command to get user entered password


I'm attempting to create a custom install CD using preseeding. I've managed to get everything to work as expected with one exception.

My preseed/late_command calls a script, which - among other things - creates a samba user using smbpasswd. The creation of this user requires a username and password and I'd like to use the ones that the user specified earlier through debconf while installing the system instead of asking for new ones. I attempted to get these values using the db_get function and I was able to get the username, but the password keeps coming up blank. Is the password blanked out to prevent someone printing it out?

As you'll see below, in my script I'm echoing the value of the variables. The result in the syslog is "Creating a new samba account for user 'user' with password ''"

Thank you for your help,
- Bill

Below is the relevant piece of the preseed and late_command scripts:

d-i preseed/late_command string chroot /target /bin/bash /cdrom/preseed/post_install.sh

#Get the password that was entered earlier
# Source the debconf library so we can make requests to the user
. /usr/share/debconf/confmodule
db_get passwd/username
db_get passwd/user-password

#This script is used to configure the VTAP server after the installation is complete.

#Create the samba user
#DEBUG - Print username and pass to syslog
echo "Creating a new samba account for user '$name' with password '$pass'" >> /var/log/syslog
(echo "$pass"; echo "$pass") | smbpasswd -a -s $name

Reply to: