#!/bin/sh # setpass by Linus Sphinx 4/11/2004 # set root password in new system and convert so only the shadow knows # Copyright (c) 2004 Linus Sphinx # Part of the gn*nix conspiracy http://gnnix.org # when consultants attack... # TZ=UTC DIALOGRC=/etc/bw.rc ROOT=/mnt/root pw=/tmp/.pw trap "rm -f $tempfile" 0 1 2 5 15 dialog --title "| Set Password For Super User |" --output-fd 4 --inputbox \ "This is the password you will use to login to your new server \ with the name of, \"root\". This is the superuser and will be used to \ finish configuration, add regular users and perform maintenance in the future. Use a minimum \ of 8 characters mixed with a few numbers, be creative please:" 16 51 4> $pw retval=$? case $retval in 0) if [ -f $pw ]; then pword=`cat $pw` if [ ${#pword} -gt 7 ]; then gnxmount echo "#!/bin/sh echo root:$pword | chpasswd pwconv ldconfig ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N \"$pword\" ssh-keygen -t dsa -f /etc/ssh_host_dsa_key -N \"$pword\" ssh-keygen -t rsa -f /etc/ssh_host_rsa_key -N \"$pword\" exit 0" > ${ROOT}/var/run/pw chmod +x ${ROOT}/var/run/pw chroot $ROOT var/run/pw rm -f $pw $ROOT/var/run/pw gnxumount else dialog --title "| DANGER OF BEING LOCKED OUT |" --msgbox "Root Password Not Set - Too Short" 5 38 fi fi ;; 1) echo "Cancel pressed.";; 255) if test -s $tempfile ; then cat $tempfile else echo "ESC pressed." fi ;; esac clear exit 0