Resetting your #1/God/Admin password
-
I have seen on various mushes where resetting the GOD password (or administrative account password) is becoming more and more the norm. Most from people who pass on databases to others to use and manipulate.
So, I'll cover here the various codebases and how to change the password.
TinyMUSH 3 nor MUX have no built in tools or mechanisms to change #1's password within the game. However, there are a few ways this can be achieved.
- If you have GDB (gnu debugger) in your unix shell, you can attach to the running process and change your password that way. This is not for the weak of heart and you could potentially do irreparable damage to your running game.
find the process
$ ps aux|grep mush tmuser 17229 0.0 0.0 24712 2816 pts/0 S 11:28 0:00 ./bin/netmush -c netmush.conf -l netmush.log -p netmush.pid -t ./text -b ./bin -d ./data -g netmush.gdbm -k netmush.db.CRASH
attach to the process. In this case PID 17229
$ gdb -p 17229 ... ... lots of text spams here ... Attaching to process 17229 Reading symbols from /home/tmuser/TM3/tinymush-3.2/src/netmush...done. ... lots more text here (gdb) call atr_clr(1,5) (gdb) quit A debugging session is active. Inferior 1 [process 17229] will be detached. Quit anyway? (y or n) y Detaching from program: /home/tmuser/TM3/tinymush-3.2/src/netmush, process 17229
Note: atr_clr is an internal function to clear an attribute. This is just like if you did in game &myattr foo. Attribute '5' if you check attrs.h (in the src directory) is A_PASS or your password attribute. So you are essentially clearing your password.
At this point you can connect to #1 without a password. At the connect screen just type:
co #1
- (A) Modify the source. This is only useful if you already have a wizard account within the database. If you don't, look at #3 below.
The file you want to modify is wiz.c (MUX is wiz.cpp) in the src directory. Look for do_newpassword. In that function you will see the line in TinyMUSH3:
if (God(victim)) { notify_quiet(player, "You cannot change that player's password."); return; }
In MUX you will see a line like this:
if (God(victim)) { bool bCan = true; if (God(executor))
You need to comment this out like so:
/* Commented out if (God(victim)) { notify_quiet(player, "You cannot change that player's password."); return; } */
In MUX you would change it to this:
/* if (God(victim)) */ if ( 0 ) { bool bCan = true; if (God(executor))
Then you need to recompile
$ make clean; make
Now restart your mush in the game (Or ./Startmush or ./Startmux respectively if you shut it down)
@restart
Now you should be able to change #1's password from any wizard account.
Make sure you revert your changes at this point or wizards will always be able to newpassword GOD. I don't think you want that
So revert your changes:
if (God(victim)) { notify_quiet(player, "You cannot change that player's password."); return; }
Or for MUX change back to:
if (God(victim)) { bool bCan = true; if (God(executor))
Recompile
$ make clean; make
And restart your mush process from #1
@restart
You should be good to go now.
- (B) Special thanks to @Autumn for reminding me of this most excellent point.
You may also modify flags.h in both MUX and TinyMUSH to change the dbref# of your GOD character. This requires that you must already know the dbref# of an existing player that you can log into or this method is pointless. Do not assign it to a guest character. Ever.
In flags.h look for the following line:
#define GOD ((dbref) 1)
Change the '1' to a dbref# of a player you know the password to, again, non-guest player. So if your player had dbref #12345, you would change the '1' to '12345'. Assuming that the dbref was #12345, it would look like this after editing:
#define GOD ((dbref) 12345)
At this point you'd recompile the source. Always make sure to make clean:
$ make clean;make
Once you have, start the mush or reboot the mush and log into the player you have defined as the GOD player. Once you do, newpassword #1 to a new password. In the example below I set it to 'abc123':
@newpassword #1=abc123
Log into #1 to make sure the password took:
co #1 abc123
Now you need to revert back your changes. Revert your flags.h changes and recompile.
#define GOD ((dbref) 1)
$ make clean; make
Now, log restart your mush and you should be good to go.
- Modify your flatfile
This again is not for the faint of heart.
First, you need to open up your netmush.db.flat file in an editor of your choice. I like vi so I'll use that as an example here. With MUX it will be netmux.flat
$ vi netmush.db.flat
Go down to the line that starts with !1
... lots of stuff before this ... !1 "Wizard" 0 -1 -1 -1 0 -1 1 -1 1000 4115 0 16 0 0 1524934266 1524934266 0 >30 "Sat Apr 28 11:50:16 2018" >49 "20 20 20 20 20" >38 "20 20 20 20 20" >5 "XXNHc95o0HhAc" ... lots of stuff after this ...
Remember above in step 2 where I showed the numeric value for the password was '5' in attrs.h? Notice the line at the end here that has >5. In the flatfile the > parameter is a declaration that the following numerical value is an attribute. The line after it will be the content of that file. Change this to "". This will make it an empty password. So, change to:
>5 ""
If that doesn't work for whatever reason, feel free to change it to the default password of 'potrzebie'. TinyMUSH still uses DES encoding. For reference it was included above, so change it to:
>5 "XXNHc95o0HhAc"
Do note for MUX it uses SHA1 password encoding so you need to change it to this instead
>5 "$SHA1$X0PG0reTn66s$FxO7KKs/CJ+an2rDWgGO4zpo1co="
Now, the fun part. Loading in your flatfile. Do this from your 'game' directory. Make SURE you have a clean data directory prior to doing this. dbconvert does not like overwriting files and you will hork your database. So my suggestion, move everything to a subdirectory.
First, make sure your game is shutdown
Second, move all the files to a subdirectory.$ cd data # assuming you're in the game directory $ mkdir storage $ mv * storage $ cd .. # to go back to the game directory
Now, let's load up your flatfile. This is assuming your mush flatfile is in your game directory. You will be exeucting this from the game directory. For TinyMUSH you would issue this command:
$ ./dbconvert -c netmush.conf -d ./data -D netmush.gdbm -X ./data/netmush.gdbm < netmush.db.flat
For TinyMUX you would issue this command, and from the data directory, not the game directory:
$ ./db_load netmux netmux.flat netmux.db
At this point, you should be good to start your mush back up. For TinyMUSH:
./Startmush
For MUX:
./Startmux
- PennMUSH:
Luckily, PennMUSH has tools that allow much easier manipulation of the database so you don't have to do the wiggy ugly shit that you have to do with MUX or TinyMUSH to change the password.
With Penn, just use the pre-defined password utility to change #1's password. You must first @shutdown your mush prior to issuing this.
# issue help on the command $ ./utils/pwutil --help # wipe #1's password $ ./utils/pwutil.pl -z --wipe 1 game/data/outdb.gz # set #1's password to 'forgetful' $ ./utils/pwutil.pl -z --set 1 --password forgetful game/data/outdb.gz
At this point, bring your mush back up:
./restart.dst
Andddd, that's it.
- RhostMUSH
Rhost, like Penn, has a nice clean way to change #1's password.
First, if you already have an immortal in the game you can change #1's password within a running game by making a change to your netrhost.conf file and rebooting. Use any editor of your choice, I will show with 'vi'.
$ vi netrhost.conf
At the bottom right before the line '# this is the last line. This should always be the last line.' add this line so it looks like this:
newpass_god 1 # this is the last line. This should always be the last line.
Now, reboot your mush
@reboot
At this point you can change #1's password from any immortal.
But hey, what happens if you don't have an immortal? Also easy:
newpass_god 777 # this is the last line. This should always be the last line.
Now, again, @reboot
@reboot
At this point, #1's password will be the default password 'Nyctasia'. So just log in with that as a password. It is case sensitive.
co #1 Nyctasia
Remove the newpass_god line from your netrhost.conf file
# this is the last line. This should always be the last line.
And @reboot again to make sure the changes are gone.
@reboot
Andd, that's it.
The example changes the password to account 'Foo' (which in this case is account#1):
Quoted from @Griatch. Thanks!
evennia changepassword Foo Password: Password again: Password changed successfully for user 'Foo(account#1)'
-
Stickied.
-
Ares has a script to do it. See Reset the Master Admin Password.
-
In Evennia you can change the password from the terminal's command line for any account, including the superuser account, using
evennia changepassword <account_name>
evennia changepassword Foo Password: Password again: Password changed successfully for user 'Foo(account#1)'
-
A very slightly easier version of #2 for TinyMUSH is to redefine GOD to the dbref of a character you do know the password for -- then recompile and restart. The TinyMUSH source code I have at hand is about ten years old, but it's probably still in flags.h:
#define GOD ((dbref) 1)
This has the advantage of allowing only the specified player to change #1's password; but it makes it even more important to change it back right away, because there's probably some code on your game somewhere that depends on #1 being God.
-
@autumn said in Resetting your #1/God/Admin password:
A very slightly easier version of #2 for TinyMUSH is to redefine GOD to the dbref of a character you do know the password for -- then recompile and restart. The TinyMUSH source code I have at hand is about ten years old, but it's probably still in flags.h:
#define GOD ((dbref) 1)
This has the advantage of allowing only the specified player to change #1's password; but it makes it even more important to change it back right away, because there's probably some code on your game somewhere that depends on #1 being God.
Most excellent. That totally slipped my mind as a valid solution. Thanks for the reminder!
I added it to the main post with credits to you.