The hashed password is stored in /web2py/parameters_[port number].py like this:
password="[hashed password]"
The hash is created via CRYPT()(password)[0], so you could replace that file with your new hashed password. The Ubuntu setup script does the following to prompt for a new password and automatically create the appropriate file:
cd /home/www-data/web2py
sudo -u www-data python -c "from gluon.widget import console; console();"
sudo -u www-data python -c "from gluon.main import save_password; save_password(raw_input('admin password: '),443)"
The gluon.main.save_password function takes the password and the port and creates the appropriate parameters_*.py file.
Anthony