System Software Lab Programs ( UNIX Programs ) – 7a

// June 7th, 2009 // Educational, Engineering, Unix and System Software Lab

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

[Click Here to get other programs by email ]

………………………………………………………………………………………………………………………….
PART -B

………………………………………………………………………………………………………………………….

7. a) Shell script to implement terminal locking. It should prompt the user for a password. After accepting the password entered by the user, it must prompt again for password confirmation (to retype the password). If a match occurs, it must lock the terminal and promp for the password. If the proper password is entered, the terminal must be unlocked. Note the script must be written to disregard BREAK, Control-D etc. No time limit need be implemented for the lock duration.

stty -echo
echo “Enter the password: ”
read pw
echo “Confirm password: ”
read cpw
if["$pw" = "$cpw"]
then
trap “.” 1 2 15 18 30
echo “Keyboard locked”
fi
echo “Enter password to resume
read npw
while["$pw" = "$npw"]
do
echo “Enter password”
read npw
done
echo “Terminal unlock”
fi
stty sane

[Click Here to get other programs by email ]