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
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipIuKfpnkmGwzpJ-6z4AFuETHXW-oatS5VulUwR-uRGWZEp8gddlLBs9kt0xZBLYAs2bAmkoSmfoehj-PREtR0YGs4DKO0xwevcn_mVTN7DqvJw_gAua3HK9Kg4zC5OHESxgLzI3AfLxM/s320/Selection_016.png)
0 comments:
Post a Comment