Joined: 10 Jun 2006
|Posted: 15.01.2011, 02:17 Post subject: Forgetting passwords can have a learning effect.
|... or so it seems.
I have this little "CMS" on my router which uses sqlite as database-backend and I had forgotten the password of the admin user.
So I found the .db file that housed the "database" and renamed it into a backup file. Then I used the .sql file that came with the CMS to create a new Database from scratch.
I used this vanilla installation to create a new admin user and then sought to migrate just this user into the old database so that I'll keep all my other tables and the data therein.
Easy I thought, copy the file over to your desktop machine and just install one of the many sqlite browsers out there.
Problem was, that the CMS used sqlite2, while all GUI tools out there use sqlite3+ ...
So ... back to reading man pages, dumping the vanilla db's user table into a text (sql) file, doing the same with the old backup DB and then moving the INSERT line for the new admin user from the new DB into the old DB replacing the old admin user's entry.
Now I just added a DROP TABLE at the top of the backup db's sql file and executed it against the backup DB, renamed it into the production DB and restarted the CMS - voila - full access again.
Needless to say that this wasn't a hack as such, as I always had (and needed) superuser access to the sqlite files...