bash - sudo with -S still asks for password on the console and clears out whiptail box -


i'm doing homework operative systems class have make login flow using bash scripting, i'm having problems want gui started using whiptail when check validity of password entered user on etc/shadow folder, sudo still asks password on console, if pass password using -s argument. here's example of i'm doing

realuser=$(whoami) user=$(whiptail --title "change password" --inputbox "please enter password" 10 60 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ];   if [ "$user" == "$realuser" ]       currentpass=$(whiptail --title "current password" --passwordbox "please enter current password" 10 60 3>&1 1>&2 2>&3)     exitstatus=$?     if [ $exitstatus = 0 ];      password=$( sudo -s <<< $currentpass grep -w $realuser /etc/shadow | cut -d: -f2)      userid=$(echo "$password" | cut -f2 -d$)      usersalt=$(echo "$password" | cut -f3 -d$)      userpassword=$(echo "$password" | cut -f4 -d$)      encryptedpass=$(perl -e "print crypt('$currentpass','\$$userid\$$usersalt\$'); \n")      if [ "$currentpass" == "$encryptedpass" ]            #do change password  ..... 

the problem when execute command

password=$( sudo -s <<< $currentpass grep -w $realuser /etc/shadow | cut -d: -f2) 

it clears out whiptail , asks user password sudo do, isn't -s <<< $currentpass passing password through stdin doesn't have ask it?

i don't know if made point clear, want is, using whiptail, ask user username, if username actual logged in user, ask user password, check if it's actual user's password , if is, change password new 1 enter.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -