If you would like to make a Garry's Mod server for yourself and a few friends, you may wish to restrict your GMOD server so that random players cannot join your server without your permission. This article covers two methods of doing so.
METHOD 1: SETTING A PASSWORD
Garry's Mod provides a built-in password function that prompts the user for a password when joining the server. Anybody who knows (or can guess) this password can join your server, so it's important to choose a strong password that is not easy to guess and only to give it to people that you trust.
- Login to your Control Panel.
- Click on the Files > Config Files tab on the left.
- Open the Garry's Mod Server Settings config file.
- Adjust the Server Password value to the password you wish to use.
- Click Save and restart your server.
Once your server has restarted, players will need to enter the password you chose above into their Garry's Mod clients in order to join your server.
METHOD 2: USING AN ALLOW LIST
Another way to protect your server from unwanted visitors is to use a list of SteamIDs to define who is allowed to join your server. Pay special attention to quotes, commas, and brackets as duplicating these or failing to insert one where necessary will result in this failing to work.
- Open your server's FTP.
- Navigate to the following directory:
garrysmod/lua/autorun/server
, then create a new file calledallowedplayers.lua
- Paste the following code into the newly created file:
local allowed = {
['YOURSTEAMIDHERE'] = true,
['ANOTHERSTEAMIDHERE'] = true
}
hook.Add('CheckPassword', 'AllowList', function (sid64)
if not allowed[sid64] then return false, 'You are not allowed on this server!' end
end) - Replace the sample values (
YOURSTEAMIDHERE
,ANOTHERSTEAMIDHERE
) in the file with the SteamID64s of you and anybody else that you wish to allow on your server. Each entry except for the last must end with a comma (,). You can use a site like steamid.io to find your SteamID64. You should end up with something that looks like this: - Restart your server. Players who are not on the list can no longer join your server.