# How to fix a WordPress installation (server level users)



## TomHat (Aug 4, 2011)

On our VPS (FreeBSD), someone deleted some of the server-level users x( that were connecting the server and the self-hosted wordpress app on a given domain. Restore is not an option because my hosting company (Verio) can only restore the whole server which would cost a small fortune (too many websites). I thought of a possible solution but I want to make sure that nothing goes wrong if I do this. Would it be possible to download all WP directories from the server, reinstall self-hosted wordpress on the domain and then upload the old WP directories back to that domain. Would that keep the WordPress site content intact and restore the server level user access between the domain and self-hosted Wordpress Ap?


----------



## tingo (Aug 5, 2011)

WordPress, like so many other xAMP stacks use a database to store the content, most likely the only things outside of the database are web templates and such.o you would need to make sure that the dtabase / databases and their contents are preserved too.

I'm not sure what "server level users" you are referring to, but wouldn't it be easier just to fix the problem (in other words; re-create those users)?


----------



## mix_room (Aug 5, 2011)

`# pw` might let you set the uid for a new user. Then everything should behave just like old times.


----------



## TomHat (Aug 6, 2011)

It appears that WP creates a record for the admin user in the mySQL database for the server when you install it. Recreating the users is not an option because the password info for the user is encrypted and WP has some kind of a link that I could not find to the admin user record. This has nothing to do with the User record in the WordPress database, but if it gets deleted from the main MySQL db, Wordpress no longer works. The only solution I found was to uninstall WP, then reinstall it. This allows me access to the WP database which is, of course, now empty of posts, categories, comments, etc. which I am now trying to recover. When I try to restore the WP database for a user, nothing works anymore. Any ideas on this?


----------



## gkontos (Aug 6, 2011)

@TomHat,

If I understand correctly the "admin" account has been hacked. Wordpress keeps all user information in the database so, assuming that you have a backup, a simple restore should work.

You can try and install your platform on a test server. It should work with minor modifications on "wp-options" table.


----------



## TomHat (Aug 7, 2011)

Actually, the issue is that WordPress does not keep all user information in the database. When you install Wordpress for a URL, WordPress adds a user record the the MySQL database on the server. Note: this is not a WordPress database, but controls access to all databases on the server. WordPress also adds a record to the wp-user table that is in the WordPress database. 

It was the user records in the "master" MySQL database that I had deleted. The WordPress databases were all intact, but I could not simply add the users again because a) WordPress uses some cryptic "UserID" in the master table (i.e., "iVg76r" for the admin user on one site and "90UIg6v" for the admin user on another) and I could not figure out how to recreate the appropriate value, and b) the password is encrypted in each database (Master DB and WordPress DB) differently. Ergo, the only solution I could come up with was to uninstall and reinstall WordPress whereby it created a new entry in the Master DB which allows me to access WordPress again. However, when I then try to restore all WP databases to the site, nothing works again, presumably because this breaks the connection between the wp-user data and the master DB user data. As a result, I am now trying to figure out how to get the posts, comments, and categories tables back into the WP database without destroying it.

Help!

Thanks for the ideas.

TomHat


----------

