Delete a UniFi Super Admin from SSH
The normal process for deleting Super Admin accounts is to go to Settings > Admins > Edit and change the role from Super Administrator to Administrator, then delete the Admin from each site on the controller.
On a controller with many sites, this can be time consuming, so we wrote a script to automate the removal process:
First, you’ll need to get SSH access to your server: https://tran-technology.com/how-to-ssh-or-sftp-into-your-unifi-server/
Log in via SSH, then use wget to download the script from GitHub:
wget https://raw.githubusercontent.com/HostiFi/mongo-delete-unifi-super-admin/master/mongo-delete-unifi-super-admin.py
Customize the -u input to provide the username of the Super Admin account to be removed. Run the script:
python mongo-delete-unifi-super-admin.py -u username
You can verify that the account has been removed under Settings > Admins inside UniFi.