What do you have so far?
I would probably use the $RANDOM functionality in bash to generate a series of random numbers, and convert these to valid ascii characters, ultimately generating a string of random ascii N characters long. Then you can use passwd along with expect to set the password, and finally a command line mail program to send it to you.
I would highly recommend writing out the password in an encrypted file for safe keeping though. If the network goes down or email service goes down, you'll lose access to the machine until it's back up, assuming the script keeps on working.
Last edited by suicidaleggroll; 04-12-2012 at 06:37 PM.