How do I find "unlicensed" users for my Bitbucket Server instance?
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
Unlicensed users are ones that are in Bitbucket user database, created locally or synchronized from external user directories, and which do not have access to Bitbucket Server on the Global Permissions page either:
- Directly via username
- Via a group which the user is part of
Resolution
Run the following query against the database:
SELECT name
FROM sta_normal_user
WHERE NOT EXISTS (
SELECT * FROM sta_global_permission WHERE user_id = sta_normal_user.user_id
)
AND NOT EXISTS (
SELECT * FROM cwd_membership WHERE parent_name IN (
SELECT group_name FROM sta_global_permission
)
AND child_name = sta_normal_user.name
);
The plugin is locked down to administrators but it can be uninstalled from the Manage Plugins
screen if preferred.