Pages

Monday, June 7, 2010

Ubuntu: Testing correct password with small script



Testing correct password with nice script

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


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

Save and exit.

Then in terminal

sudo chmod +x pass.sh

sudo ./pass.sh

The password is 'abc123'

This script is learning purpose only

0 comments: