Monday, June 7, 2010

Ubuntu: Testing correct password with small script

Testing correct password with nice script

Open a text file using gedit. Copy and paste the following lines

# Script accept password using read commnad
# Not *very secure*, this script is for learning purpose only
# -------------------------------------------------------------------------
read -s -p "Password: " mypassword
echo ""
[ "$mypassword" == "$PASS" ] && echo "Password accepted" || echo "Access denied"

Save and exit.

Then in terminal

sudo chmod +x

sudo ./

The password is 'abc123'

This script is learning purpose only