I've got a computer prepared to sell and I just need to do one more thing, force the user to configure root password and user account, but haven't had any luck. Well, that's not entirely true, I've started working on a script using dialog, and have plans on starting another script using xdialog that would run when X starts up first. However while preparing the section for creating the user groups I realized that it's going to take me at least a week to get that part figured out, then another week to spruce up the code. I'm not too scared of figuring it out on my own, hell, I'd prefer the groups being a checkbox rather than an edit box like the installs have. That way a person installing it can look over and see what all of the groups are, oh, and add a help button so they would know what all the groups are, too (This is why it'd take me so bloody long to code it...Hmm...Probably take a whole month)...
Either way, where are the configuration scripts located? or Is it even possible to use only the root/user config scripts so this system would force the purchaser to configure them? or Any other ideas?
Thanks...
<Edit> Someone just asked this question earlier today at linuxquestions, so posting it on the iffy side someone comes across this one...
http://www.linuxquestions.org/questions ... de-783616/
Are there/where are the configuration scripts?
Are there/where are the configuration scripts?
Last edited by Mol_Bolom on 21. Jan 2010, 05:39, edited 1 time in total.
Re: Are there/where are the configuration scripts?
I'm not really sure what you're asking. If you're talking about usersetup, that's in /usr/sbin.
You can add an rc script in /etc/rc.d/ that will ask for the root password, then display a message that the user needs to create a non-privileged account, then run usersetup, and have the script delete itself after everything is done.
You can add an rc script in /etc/rc.d/ that will ask for the root password, then display a message that the user needs to create a non-privileged account, then run usersetup, and have the script delete itself after everything is done.
Re: Are there/where are the configuration scripts?
Was able to test it today, and yep that's what I was looking for.gapan wrote:I'm not really sure what you're asking. If you're talking about usersetup, that's in /usr/sbin.
Ah, if it was only that easy. If I put it in rc.4 before gdm starts, usersetup then has issues, or quits, and gdm goes ahead and starts. If I put it at the end of rc.inet2 then the splash screen never ends. Looks like I'll have to change vga to normal and write a whole new script that will run lilo and reset back to 751. Hopefully I can find a way around that...You can add an rc script in /etc/rc.d/ that will ask for the root password, then display a message that the user needs to create a non-privileged account, then run usersetup, and have the script delete itself after everything is done.
Anyway...Thanks...
Re: Are there/where are the configuration scripts?
I think it really is easy. You can add something like:
at the end of rc.S, change the default init to 3 by editing /etc/inittab, and then have that script first shut down the bootsplash, ask for new root password, run usersetup, set the init back to 4 using sed and then have it delete itself.
Code: Select all
if [ -x /path/to/your/script ]; then
. /path/to/your/script
fi
Re: Are there/where are the configuration scripts?
Put it into rc.M. At least that's where zenwalk puts it postinstall script.Mol_Bolom wrote: Ah, if it was only that easy. If I put it in rc.4 before gdm starts, usersetup then has issues, or quits, and gdm goes ahead and starts. If I put it at the end of rc.inet2 then the splash screen never ends. Looks like I'll have to change vga to normal and write a whole new script that will run lilo and reset back to 751. Hopefully I can find a way around that...
rc.postinstall of Zenwalk: http://pastebin.org/78275
rc.M of Zw: http://pastebin.org/78276
Instead of splash you might have to put splashy into verbose mode.
Re: Are there/where are the configuration scripts?
After trying it out in rc.M I found how to get around splashy. Before calling the script I used chvt 8, for some reason at the beginning of rc.M the system would hang, after the exit script for splashy, then it would load only on vt 8 no matter where I put it. Either way, it works now...Shador wrote: Put it into rc.M. At least that's where zenwalk puts it postinstall script.
rc.postinstall of Zenwalk: http://pastebin.org/78275
rc.M of Zw: http://pastebin.org/78276
Instead of splash you might have to put splashy into verbose mode.
in rc.M
Code: Select all
#After exiting splashy...
if [ -f /etc/rc.d/configusers ]; then
/usr/bin/chvt 8
/etc/rc.d/configusers
fi
Code: Select all
#!/bin/bash
dialog --msgbox "Before running the system you need to setup a password
for your root account and create one or more user accounts.\n\nPress enter to
continue." 15 45
passwd
dialog --title "Note:" --msgbox "/home is a seperate partition for all
users. If you wish to change the user directory, then there will be an
extra partition that is not being used." 15 30
usersetup
rm /etc/rc.d/configusers
Also, the usersetup script is different than the setup scripts in the install, so I might as well remove the last dialog I added. It seems to automatically use the /home directory for users. Though just in case someone might want to change it, probably would be a good idea to leave it in there.
Anyway, thanks for all yer help......
Re: Are there/where are the configuration scripts?
Look in the SeTpasswd script used in the installer to get an idea. It's in svn: http://sourceforge.net/apps/trac/salix/ ... /SeTpasswd
You don't have to chroot as that does, you're already using that partition.
You don't have to chroot as that does, you're already using that partition.
Re: Are there/where are the configuration scripts?
Thanks gapan...takk gapan...wado gagwan...kolaval kapan...
Worked like a charm...
Basically the same script, just modified a little.
Worked like a charm...
Basically the same script, just modified a little.
Code: Select all
#!/bin/sh
dialog --title "Password setup" --msgbox \
"You will be presented with some dialogs to setup a password for the \
root user. Make sure that this is a strong password.\n\nAfter that you \
will be presented with a menu that allows you to setup user accounts. \
You are advised to create at least one non-privileged user account for \
everyday use.\n\nUsing the system as the root user is highly not \
recommended. \
disabled by default." 0 0
# Password dialog
passbox(){
DIALOG='dialog --stdout --insecure --fixed-font --no-cancel --smooth --passwordbox'
pw="$(${DIALOG} "${1}" 12 80)"
echo -n "$pw"
}
# Password checking
changepw(){
minlength=5
count=1 ; pw='_'
while [ "${pw}" != "${password}" ]; do
password="" ; pw='_'
message="Enter password for the root user:"
[ $count -ge 2 ] && message="Passwords don't match, enter password for the root user:"
while [ ${#pw} -lt ${minlength} ]; do
pw="$(passbox "${message}")"
message="Password is too short (${minlength} chars minimum), please try another one:"
done
password="$pw" ; pw='_'
message="Enter password for the root user again:"
pw="$(passbox "${message}")"
count=$((count+1))
done
echo -n $password
}
# Change password
setpw() {
pass="$(changepw root)"
if [ ! "$pass" ] ; then
dialog --msgbox "Failed to set password for the root user" 8 75
else
echo "root:${pass}" | chpasswd
fi
}
setpw
dialog --title "Note:" --msgbox "You are now ready to add users to your
system. /home is a seperate partition set aside for this
purpose.\n\nPress enter to add users." 15 30
/usr/sbin/usersetup
rm /etc/rc.d/configusers
Re: Are there/where are the configuration scripts?
Yes splashy is a bit sloooow to respond to the exit command.
Re: Are there/where are the configuration scripts?
killall splashyJRD wrote:Yes splashy is a bit sloooow to respond to the exit command.
killall -9 splashy