Project Zomboid does not currently support the use of game passwords to limit access to your server. 


You can however, setup a whitelist that will limit access to your server, Here's how;

in the ServerConfig.ini change the following values:

public=false

Open=true 

AutoCreateUserInWhiteList=false


Now what you want to do is get you and your friends to login with :

 

Server Username - Set your username: example - Grandbaker

Server Password - Set your password: example - nf32ib4u3y2

Save or Add to saved servers, this well keep all the settings for that server alone.


Once they are registered and logged in you will return to the configs and change them to the other way around:


open=false


AutoCreateUserInWhiteList=true


This should make it so only people who have accounts on your server can join.