I’m running an instance for my own blog at agger — WriteFreely@Modspil.dk
Naively, I had allowed open registration back in March. Today, to my horror, I see that I now have ~1200 spam accounts.
I started deleting them through the UI, but soon gave up - it’s taking too much time.
I SSH’ed to the server and deleted some with writefreely user delete, but that’s also a pain because you have to confirm deletion each time so it’s not easily scriptable. Also the writefreely program doesn’t allow me to list all users, so it’s not easily scriptable.
Does anyone know of there is an easy way to achieve this?
Thanks in advance for any response 
1 Like
Also, I don’t understand why the spam blogs aren’t listed on the admin dashboard. Is there something I should enable?
OK, so I found a solution I can kind of live with.
I made a small script which I named delete, like so:
#!/bin/bash
echo "deleting user $1"
echo 'y' | ./writefreely user d $1
Then I copy the list from /admin/users, one page at a time (there isn’t an option for showing all users at once), insert it into a file called lusers, and then I do
for luser in $(cat lusers| cut -d ' ' -f 1); do ./delete $luser; done
This is not really ideal … EDIT: I got it done rather quickly, though, by copying the users to the file one page at a time
2 Likes
A quick way to list all users (for instances powered by MariaDB) is accessing the database, listing all users, and sorting them by registration date.
mariadb -u writefreely -p -e "SELECT username FROM users ORDER BY created DESC" writefreely > users.txt
Then you just open the file, and erase the lines for the users you actually want to keep.
I was using a simple for script in Bash to parse the file, but the manual confirmation is tedious, so I’ll copy your delete script