How to Batch Delete Spam Accounts from the Cyberia Blog
There may be spam accounts on the cyberia blog, as happened when the Writefreely software had a vulnerability in July 2026 and spammers made a bunch of accounts and posts.
Obviously, we don't want that, so we need to have a way to clear them out if that happens.
Delete users manually through the Admin web interface
If there are only a few accounts, anyone with admin access to the Cyberia blog (only zico at the time of writing) can delete a user and remove all their posts:User Menu > View Blogs > User Menu > Admin Dashboard > Users > click on spam user > scroll to bottom and click "Delete User".
If there are many spam accounts, this is a long and tedious process. To speed it up, we can get the Writefreely MySQL database to give us a list of all users (sorted by creation date) and prune the real users from it.
Batch delete spam users with the writefreely command
Get a List of users
Log in to elliot.cyberia.club using your account. Then:
$ sudo -i
## -s -r for removing the tabulature mysql normally uses, so we can get a nice clean list
# mysql -u root -p -s -r writefreely
(press Enter for empty password)
MariaDB [writefreely]> select username from users order by created info into outfile '/tmp/writefreely-users.txt';
MariaDB [writefreely]> \q
# cp /tmp/writefreely-users.txt /var/www/blog.cyberia.club && chown writefreely:writefreely /var/www/blog.cyberia.club/writefreely-spam-users.txt
# su - writefreely
$ cd /var/www/blog.cyberia.club
Edit list to only include spam accounts
Edit the writefreely-spam-users.txt file to remove the legitimate non-spam users from the list. The list is sorted by user creation date, oldest at the top (please don't delete legit users; idk how to recover them yet). If you aren't sure which accounts are Cyberia users, please ask in the matrix channels (probably #services).
Delete Spam Accounts
NOTE: YOU MUST REMOVE THE LEGITIMATE NON-SPAM USERS BEFORE RUNNING THIS SCRIPT!
Use the script I wrote to procedurally iterate through the spam users and remove their account and any posts from the blog.I recommend doing this as the writefreely user.$ ./batch-delete-writefreely-users.sh < ./writefreely-spam-users.txt
This script will autoconfirm the deletion, so check the list before you run that command.
Check your work
Check the blog and make sure the spam accounts are deleted and their posts removed. Job done!
This text can also be found on elliot.cyberia.club at /var/www/blog.cyberia.club/how-to-batch-delete-spam-accounts-writefreely.txt