Thursday 21 May 2015

Write shell script to implement terminal locking (similar to the lock command). It should prompt the user for a password. After accepting the password entered by the user, it must prompt again for the matching password as confirmation and if match occurs, it must lock the keyword until a matching password is entered again by the user, Note that the script must be written to disregard BREAK, control-D. No time limit need be implemented for the lock duration.. VTU MCA UNIX LAB3A

echo "Enter a password"
read pass1
echo "Renter password"
read pass2
if [ $pass1 = $pass2 ]
then
    echo "Keyboard is locked"
    trap " " 20 30 15 9 2 1 3
    echo "Enter your password to unlock the screen"
    read upass
    while [ "$pass2" != "$upass" ]
    do
        echo "password is wrong !! "
        echo "Renter password"
        read upass
    done
else
    echo "Password doesn't match"
fi

No comments:

Post a Comment