Page 1 of 1
Automated installation - Seed and Password??
Posted: Tue Mar 23, 2010 6:55 pm
by nshenry03
Hello,
I am trying to automate the installation of netjukebox and I am running into some problems with automatically changing the username and password of the admin user...
Does anyone know how I can generate a valid password/seed using bash and/or php so that I can simply update the user table with the correct info?
Thanks!
Re: Automated installation - Seed and Password??
Posted: Tue Mar 23, 2010 9:12 pm
by nshenry03
Nevermind, this works:
Code: Select all
...
z_passwd_randkey=$( $PHP_BIN -r "define('ABSPATH','${WWW_CODE_DIR}/'); require_once( ABSPATH . 'include/library.inc.php' ); fwrite(STDOUT, randomKey());" )
z_passwd_njhash=$( $PHP_BIN -r "define('ABSPATH','${WWW_CODE_DIR}/'); require_once( ABSPATH . 'include/library.inc.php' ); fwrite(STDOUT, hmacsha1(hmacsha1('${z_passwd}', '${z_passwd_randkey}'), '${z_passwd_randkey}'));" )
mysql --database="myDatabase" --user="myUsername" --password="myPassword" --execute="UPDATE user SET password = '${z_passwd_njhash}', seed = '${z_passwd_randkey}', username = '${z_defaultuser}' WHERE user_id = '1';"
...
Thanks!
Re: Automated installation - Seed and Password??
Posted: Thu Mar 25, 2010 9:58 am
by wbartels
Another possibility is to modify the default password in the “sql/netjukebox_xx.sql” file.
Code: Select all
-- --------------------------------------------------------
--
-- Default users
--
INSERT INTO `user` VALUES ('admin', '4008750ce237101f5e39ec63c8ae46f134a40a65', 'xrR1KfV9FfLAwj2YMfeK1cttaMRHafauezAmbg51', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, NULL);
INSERT INTO `user` VALUES ('anonymous', 'adf8efe68157cf37503f86d602bec6d593750c33', 'I33sJY_HNVMlbGL1nBzY0VdXebb4oSkJIGcnZzLZ', 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
$seed = randomKey();
First item is username:
username
Second item is password:
hmacsha1(hmacsha1('password', $seed, $seed));
Third item is seed:
$seed;
Fourth item:
1
Where the anonymous password must be the same as the anonymous username, normally: "anonymous"