# add users -*-perl-*- sub root_password { local ( $pid ); &rhs_msgbox("Root Password", < You will now enter a password for the root user (super-user). If you forget this password, you must re-install the system! > EOM , 60); system("cp -f $fsmount/etc/passwd /etc"); symlink("$fsmount/etc/npasswd.conf", "/etc/npasswd.conf"); system("passwd"); system("cp -f /etc/passwd $fsmount/etc"); # if ($pid = fork) { # waitpid($pid, 0); # } else { # chroot $fsmount; # system("passwd"); # exit 0; # } return 1; } sub add_users { local ( $prompt, $username, $pid, $command ); $prompt = < Do you want to create a user account? > EOM ; while (1) { if (! &rhs_yesno("Create User", $prompt, 50)) { return 1; } $prompt = < Do you want to create another user account? > EOM ; if (! &rhs_inputbox("User Name", < Enter a name for the user account, up to 8 characters. > EOM , 60, "")) { return 1; } $username = $dialog_result; if (&rhs_yesno("Home Directory", < If your home directories will be mounted via NFS, you can skip this step. Otherwise, create a home directory. > Do you want to create a home directory for $username? > EOM , 60)) { $command = "adduser $username"; } else { $command = "adduser $username NOHOME"; } &rhs_infobox("Create User", < Creating user account... > EOM , 60); if ($pid = fork) { waitpid($pid, 0); } else { chroot $fsmount; open(SAVEOUT, ">&STDOUT"); open(SAVEERR, ">&STDERR"); open(STDOUT, ">/dev/null"); open(STDERR, ">/dev/null"); system($command); open(STDOUT, ">&SAVEOUT"); open(STDERR, ">&SAVEERR"); exit 0; } } } ########################### 1;