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

wrapper for kpasswd



Changing the Kerberos password using a web browser is sort of 
uncomfortable. The following script uses kdialog boxes and could be 
executed via ALT-F2 or via a .desktop file. It works for me. To be 
useable in GNOME as well, xdialog would be better though but IIRC it 
looks ugly.

-------------------------------------------------------------------

#!/bin/bash
#
#/usr/local/bin/kpwd
#
# change Kerberos-Password  

read_old_pw() {
PASSold=$(kdialog --password "Please enter your current password:");
if [ $? != 0 ]; then
	kdialog --error 'Cancelled. Password wasn't changed.'
	exit 1
    fi
}

read_new_pw() {
PASSnew=$(kdialog --password "Please enter the new password:"); 
PASSnew2=$(kdialog --password "Please enter the new password again:"); 
if [ "$PASSnew" != "$PASSnew2" ]; then
	kdialog --sorry 'The entries didn't match. Please try again.'
    else
	NEW="true"
    fi
}

read_old_pw

NEW="false"

while [ "$NEW" = "false" ]; 
    do
    read_new_pw
    done

if kpasswd <<EOF
$PASSold
$PASSnew
$PASSnew
EOF
    then
	kdialog --msgbox 'The password was changed successfully.'
    else 
	kdialog --sorry 'The current password was incorrect. \n Please start again.'
    fi

------------------------------------------------------------------

Wolfgang

Attachment: signature.asc
Description: Digital signature


Reply to: