#!/bin/bash
clear
echo "This script changes your admin password for FreePBX 2.11 access."
echo " "

echo -n "Enter new admin password (MAKE IT SECURE!!): "
read adminpw
echo " "
echo "admin password will be changed to: $adminpw"
read -p "Press ENTER key to continue or Ctrl-C to abort..."
mysql -u root -ppassw0rd -e "update asterisk.ampusers set password_sha1 = '`echo -n $adminpw | sha1sum | cut -f 1 -d " "`' where username = 'admin' limit 1;"
echo " "
echo "Done. Use browser to access FreePBX at http://`ip route get 8.8.8.8 | tr -s ' ' | cut -f 7 -d ' '`"
echo " "
