Killing Floor 2 Auto-Kick Bot on Linux Dedicated Server

Update: this functionality has been incorporated into my Killing Floor 2 Linux Server Installer. I recommend you use that instead.


With the Killing Floor 2 Treacherous Skies patch things got considerably harder, especially on HoE difficulty. So, more than ever, it’s critical to have good players and good perks, otherwise your wipe is guaranteed.

On top of that, now we have the prestige system which resets your perks to zero. Unfortunately, a good number of vets are under the impression that their gaming skills can somehow make up for the perk skills they lack, such as:

  • explosives immune to the siren’s scream
  • +500% shotgun penetration
  • +200% syringe recharge rate and +50% syringe potency
  • +500% call out range
  • +100% mag size
  • no damage reduction from shooting through ZEDs
  • 40% reduced damage by parry

The list goes on, you get the idea. While that’s definitely not the case, there’s just no end to arguing with such vets, both on reddit and in game chat. They refuse to go suicidal, let alone hard, because that’s just so degrading, you know. That’s for kiddies, I’m a grown up KF vet with awesome gaming skills, so I have a free pass to HoE!

Anyhow, the good news is, there’s a solution, that won’t even derank your server: kf2_autokick for the rescue! This awesome bot will allow you to automatically kick/ban players based on the minimum perk level requirements you set. No more level 3 survivalists ruining wave 7.

Let’s do it!


This guide assumes you’ve fully completed the Dedicated Killing Floor 2 Server on Linux tutorial, so everything here will be explained as such.


First you need to do some administration, so do these as your regular user (i.e. not the steam user):

curl --silent --location | sudo bash -
curl --silent --location | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install nodejs yarn dos2unix

Now create a system service file to run the bot:

sudo mcedit /etc/systemd/system/kf2autokick.service

Then paste the following (Shift + Insert):

Description=KF2 Auto-Kick Bot

ExecStart=/bin/node /home/steam/kf2autokick/lib/index.js --config=/home/steam/Config/autokick.json


Save with F2, then exit with F10. Now also apply the changes, and make autokick start automatically:

sudo systemctl daemon-reload
sudo systemctl enable kf2autokick.service

Create a new sudoers file so that the steam user will be able to control the autokick service:

sudo mcedit /etc/sudoers.d/kf2autokick-sudo

Paste the following:

%steam ALL=NOPASSWD: /bin/systemctl start kf2autokick.service
%steam ALL=NOPASSWD: /bin/systemctl stop kf2autokick.service
%steam ALL=NOPASSWD: /bin/systemctl restart kf2autokick.service
%steam ALL=NOPASSWD: /bin/systemctl status kf2autokick.service
%steam ALL=NOPASSWD: /bin/journalctl --system --unit=kf2autokick.service --follow


Now switch to the steam user:

sudo -iu steam

Now install kf2_autokick:

git clone ~/kf2autokick
cd ~/kf2autokick
yarn --frozen-lockfile

Fix the line ending format of the file, then open it for editing:

dos2unix ~/Steam/KF2Server/KFGame/Web/ServerAdmin/
mcedit ~/Steam/KF2Server/KFGame/Web/ServerAdmin/

Find the following line:


Replace it with this:

<td class="foo-bar"><>;<%player.perk.level%>;<%player.playerkey%></td>

Save and exit. Now create the config file for your autokick script:

mcedit ~/Config/autokick.json

Paste the following:

  "servers": [""],
  "basicAuthorization": "Admin:YOURADMINPASSWORD",
  "intervalCheck": 5000,
  "action": "kick",
  "minLevel": 20,
  "warnings": true,
  "warningPeriod": 20000,
  "warningMessage": "Minimum level is 20. Please switch perk or you'll be auto-kicked in 20 seconds."

This checks the user list every 5 seconds, and kicks if the user doesn’t change to a level 20+ perk within 20 seconds. Change the Admin password to yours, and change the other parameters according to your needs, then save.


mcedit ~/bin/

Edit it like so:


set -Eeu

function errorexit ()
    case $? in
            echo "Usage: $0 {start|stop|restart|status|log"

            echo 'error!'


trap errorexit EXIT

if [ "$#" -ne 1 ]
    exit 1

case $1 in
        sudo /bin/systemctl start kf2autokick.service

        sudo /bin/systemctl stop kf2autokick.service

        sudo /bin/systemctl restart kf2autokick.service

        sudo /bin/systemctl status kf2autokick.service

        sudo /bin/journalctl --system --unit=kf2autokick.service --follow

        exit 1


Now you also need to change webadmin authentication to basic auth, since that’s what the auto-kick bot will use. Open My-KFWebAdmin.ini:

mcedit ~/Config/My-KFWebAdmin.ini

Then make sure it contains the following lines:


Also open My-KFWeb.ini

mcedit ~/Config/My-KFWeb.ini

It needs to have these lines added:


Now apply the changes: stop config start


Now, still as the steam user, you can finally start the autokick bot: start

If you make changes to autokick.json, make sure to restart it to apply the changes: restart

If you want to see this bot in action, feel free to join my Killing Floor 2 servers!

Welp, I think that’s pretty much it. Enjoy, folks!

Tags: , , , , , , , , ,