How to Audit Who Has Admin Access to Your Site and Remove the Rest

To audit admin access to a website, you inventory every path that can change code, content, configuration or data, then remove or downgrade everything that does not need to be there. The audit is not a one-off scan: it is a repeatable process you run on a schedule, because admin access creeps back in through plugins, API keys, deploy tokens and forgotten accounts. This guide walks through that process for a typical self-hosted site, and most of it applies to managed platforms too.

Start by defining what "admin" means on your stack. On a WordPress site it is the administrator role plus anyone with edit_plugins or edit_users capability. On a custom application it is whatever your authorization layer treats as privileged. On the infrastructure side it is shell access, database superuser accounts, control panel logins and anything holding a deploy key. Write that list down before you touch anything, because you will be checking against it repeatedly.

Inventory accounts through the application itself

Query the user table directly rather than clicking through an admin UI, which hides inactive and orphaned accounts. For a WordPress database, this returns every privileged account with its registration date and last activity:

wp db query "SELECT u.ID, u.user_login, u.user_email, u.user_registered,
  MAX(m.meta_value) AS last_login
  FROM wp_users u
  JOIN wp_usermeta m ON m.user_id = u.ID AND m.meta_key = 'wp_capabilities'
  WHERE m.meta_value LIKE '%administrator%'
  GROUP BY u.ID;"

The output is a plain table of IDs, logins, emails and timestamps. Anything you cannot tie to a named person with a current reason to hold the role is a candidate for removal. Do the same for any custom users table, selecting on your privilege column. If your application stores roles in a separate join table, join through it; the principle is the same, which is to let the database tell you the truth rather than the interface.

Check for shared and service accounts

Shared logins are the hardest to remove because nobody admits to owning them. Look for generic names, addresses on free mail providers, and accounts whose email domain does not match your organisation. Each one needs a named owner or deletion. Service accounts that exist only to run cron jobs or integrations should be moved to a dedicated role with the minimum capability required, not left as administrators.

Audit keys, tokens and integrations

Accounts are only half the surface. Every API key, deploy token, OAuth application and webhook secret is a credential that grants access without a login. Enumerate them from the application's own storage and from your version control and CI configuration. A quick sweep of a code checkout catches secrets committed by accident:

grep -rInE '(api[_-]?key|secret|token|password)\s*[:=]' \
  --include='*.php' --include='*.env' --include='*.yml' . \
  | grep -v vendor/

Expect noise from example files and test fixtures; the point is to find live values in tracked files. For each hit, decide whether the credential is still needed, rotate it if it is, and revoke it if it is not. Rotating is cheap; assuming a leaked key was never used is not. Also check the application's own settings for stored integration tokens, and the hosting control panel for SSH keys and cron entries that call external endpoints.

Review the web server and database layers

Admin access often hides in configuration rather than in user tables. On Apache, look for Require directives that grant broad access; on nginx, check allow and deny rules and any auth_basic blocks protecting admin paths. A typical hardened location block restricts the admin area to known addresses:

location /wp-admin/ {
    allow 203.0.113.10;
    deny all;
    include fastcgi_params;
}

Replace the example address with your own office or VPN range. On the database side, list accounts and their grants with SELECT user, host FROM mysql.user; and SHOW GRANTS FOR 'user'@'host';. Any account connecting from % with ALL PRIVILEGES deserves scrutiny. Application accounts should hold only the privileges the application uses, and administrative accounts should connect from restricted hosts.

Run the audit admin access website checklist on a schedule

Turn the steps above into a written checklist you repeat at a fixed interval, and record the result each time so you can see drift. The checklist should cover application administrators, service accounts, API keys and tokens, SSH keys, database accounts, control panel users and web server access rules. For each item, record the owner, the reason it exists and the date it was last reviewed. An item with no owner is an item to remove.

When removing access, work in the safe order: revoke credentials first, then downgrade roles, then delete accounts, and keep a record of what you changed. Take a database backup before bulk role changes, and test that the site still functions after each batch. Removing an administrator who turns out to run the payment integration is a self-inflicted outage, so confirm ownership before you delete.

Finally, reduce the number of paths that can create admin access in the first place. Disable user registration where it is not needed, require strong authentication for privileged roles, and keep the list of people who can grant admin rights short. The audit is only as good as the controls that stop the list from growing again.

Next, pick one system, run the account query and the secret sweep against it this week, and write down what you find. Then schedule the full checklist for a recurring date and put the results somewhere your team can see them. The first pass will be messy; the second will be fast, and that is the point.

Related articles

Subscribe to our newsletter

Get the latest hosting tips, performance insights, and industry news.