How to Ban Players from your Don't Starve Together Server
Sometimes you will have people connect to your Don't Starve Together server and disrupt everyone's fun by being unpleasant, rude, or actively destroying everyone's hard work (Seriously, what's up with griefers? Don't they have something better to do?).
If players do cause trouble on your server, you can ban them from connecting to your Don't Starve Together server in the future. You can do this through admin commands, or by creating (or editing) a file called blocklist.txt
, and entering ID numbers into the file.
Admin commands only work if the troublemakers are still on the server, and commands have to be done manually by an admin.
The
blocklist.txt
file will work automatically, 24-7, day in and day out.
How to Ban Someone With Commands
If the miscreants are still on your server, there are admin commands that can be used to smack them with the ban hammer. The commands only work if they're still connected to the server, though. If they've already left, skip down to the next section, about how to find the ID numbers from the logs.
This, of course, also requires that someone who is an admin be on the server to ban them manually. We have an article on how to add admins within our knowledge base.
Admin Commands
The admin commands that will be useful for banning players are as follows:
Get the list of players, with their KU IDs
c_listallplayers()
This will print out a list of all currently connected players, including their KU ID numbers.
Admin command to ban them
TheNet:Kick ("KU ID")
Replace KU ID, with that player's actual ID number. Leave the parenthesis and quotes, though, they are important.
For example:
TheNet:Kick("KU_AABBCCDD")
How to Ban with ID Numbers
Most griefers won't be so nice as to give you their ID numbers, so you'll have to find these. The game thankfully makes logs that will contain the ID numbers. These files are made and replaced each time the server is started. So if a player caused a problem on your server, you will need to get the numbers out of the logs first, or they'll be erased the next time the server is restarted.
Different ID Numbers
You can use either the KU ID or the player's Steam64ID. Both will work. It's worth mentioning that the game Don't Starve Together is not exclusively offered on Steam (it can be purchased directly from Klei, without using Steam at all). The KU ID will work for any player, but then if they're not using Steam, there won't be a Steam64ID number.
Using the Server Logs
In the /.klei/DoNotStarveTogether/MyDediServer
directory, you can open either the Master
or Caves
directories. Each directory contains a completely separate collection of files. If the trouble happened in the regular surface world, you will need to look in the logs in the Master
directory, if it happened in the caves, you need to look in the logs in the Caves
directory.
Inside each directory, you will see a file called server_log.txt
.
Select this file and click on the Edit
button. This will open a text editor, showing the contents of the server log. This file is going to be very long. All the information from the server loading files and starting up is there.
Searching the Logs Quickly
There's a quick way to search the entire log, though. You can hold down Ctrl
and press the F
key to open a search bar at the top of the text editor window.
You want to look for a message about "Client Authentication", so type authenticated
in the search window. It will jump to the first occurrence of the word "authenticated" and highlight all of them, like the screenshot below:
On lines #472 and #475, the KU ID of the player is in parentheses (blocked out in these examples), right before their name. On line #473, a Steam64ID number is listed (which is also blocked out in the example).
Get IDs from Chat Logs
You can also get a player's KU ID from the chat logs on the server if they said something in chat. These logs will be located in both the "Master" and "caves" directories (/.klei/DoNotStarveTogether/MyDediServer/Master
or /.klei/DoNotStarveTogether/MyDediServer/Caves
). The logs are called server_chat_log.txt
. These logs are also replaced each time the server starts.
Select the file, and click Edit
on the Nodecraft control panel, to show the contents of the log.
You can use the same search feature mentioned above, by holding Ctrl
and pressing F
to open a search bar. Type the name of the player, if you remember it, and it will jump directly to the corresponding lines in the file.
A player's KU ID should be listed in front of every message they have sent.
Create or Edit blocklist.txt
In the /.klei/DoNotStarveTogether/MyDediServer
directory, you will need to create a file called blocklist.txt
. If you already have one, you can just open and edit the existing file, by clicking on the Edit
button.
You can create the file directly in the Server Files window on the Nodecraft Pro panel, by clicking on the button Create File
. This opens a text editor window.
At the top of the window, click on the dark gray text that says my-file-name.txt
and replace it with blocklist.txt
. Then, on the flashing cursor bar, enter the ID numbers. You can use either a KU ID or a Steam64ID number. Enter each ID number on its own line.
Once you're done, save the changes, and exit the editor window.
Restart the Server
The newly created (or edited) blocklist won't be loaded by the game unless the server is restarted, so please do that now.
Once that's done, the griefers will be given the boot the next time they try to join your server, and they will see the image below when they try to join!