
MeshCentral keeps almost every setting that shapes its behaviour in a single file, config.json, stored in the meshcentral-data folder. Learning to read and edit this file confidently is what separates a default installation from one tailored to an organisation's needs. Certificates, ports, databases, authentication, branding, backups, network restrictions and multiple customer portals are all controlled from here. This article explains how the file is structured, which settings matter most, how domains let one server host several independent portals and how to edit the file safely without locking yourself out.
Where the File Lives and When It Is Read
The first time MeshCentral starts, it creates the meshcentral-data folder and, if no configuration exists, a basic config.json. The server reads the file at startup, so changes take effect only after a restart. On a systemd installation that means restarting the service; in Docker, restarting the container.
Because the file can contain secrets such as database passwords and backup passphrases, restrict its permissions to the MeshCentral service account and treat it with the same care as the certificates stored beside it.
The Overall Structure
A MeshCentral configuration is a JSON object with a few top-level sections.
- settings holds server-wide options: the hostname, ports, database connection, backups, network behaviour and proxy handling.
- domains defines one or more portals, each with its own users, devices, branding and login rules.
- letsencrypt configures automatic certificates, when MeshCentral obtains them itself.
- smtp and similar sections configure outgoing email and messaging for notifications, password resets and email-based verification.
A minimal but realistic configuration might look like this:
{
"settings": {
"cert": "mesh.yourdomain.example",
"port": 443,
"redirPort": 80,
"WANonly": true,
"autoBackup": {
"backupIntervalHours": 24,
"keepLastDaysBackup": 14
}
},
"domains": {
"": {
"title": "Company Device Management",
"title2": "IT Support",
"newAccounts": false,
"userSessionIdleTimeout": 30
}
}
}
Switching Settings Off with Underscores
MeshCentral ignores any key that begins with an underscore. The sample configuration supplied with the project uses this convention extensively: dozens of options are present but prefixed with an underscore, so they have no effect until the underscore is removed. It is a convenient way to keep an option documented in your file while leaving it disabled, and to switch settings off temporarily during troubleshooting.
To disable a setting without deleting it, add an underscore to the start of its name.
Key Server Settings
Hostname and ports
The cert value sets the hostname used for the server's certificate and the links it generates. The port and redirPort values control the HTTPS and HTTP ports, while aliasPort tells MeshCentral which public port users actually connect to when a proxy or port mapping changes it.
Network modes
The WANonly setting disables local network discovery features that are unnecessary on an internet-facing server, while LANonly suits a server confined to a private network. Choosing the right mode reduces noise and exposure.
Database
By default, MeshCentral uses its built-in database inside the data folder. Adding a connection setting for MongoDB, PostgreSQL or MariaDB/MySQL switches the server to that database. Connection details often include a password, so this is one of the reasons the file must be protected.
Reverse proxy handling
The tlsOffload, trustedProxy and certUrl settings tell MeshCentral that a proxy is terminating TLS, which addresses to trust for forwarded client information and where to read the certificate the proxy presents.
Automatic backups
The autoBackup block schedules backup archives, controls how long they are kept, sets a password for them and chooses where they are written.
Session recording
A recording section enables recording of remote desktop and terminal sessions, specifying where files are stored and, optionally, limiting recording to particular device groups.
Domain Settings That Shape the User Experience
Each entry under domains represents a portal. The empty string key is the default domain, served at the root of the server. Within a domain, commonly used settings include:
titleandtitle2, which brand the page header;newAccounts, which controls whether visitors can register;passwordRequirements, which sets password rules and can force two-factor authentication;userSessionIdleTimeout, which signs out inactive users;userAllowedIPandagentAllowedIP, which restrict the networks allowed to reach the login page and to connect agents;- authentication options for LDAP or single sign-on providers.
Domain-level settings make it possible for one server to behave quite differently for different audiences.
Hosting Several Portals with Domains
One of MeshCentral's most useful capabilities is hosting multiple independent domains on a single server. Each domain has its own users, device groups, settings and branding, and users of one domain cannot see the devices of another. Domains can be reached in two ways:
- by path, where a domain named for a customer is served under its own folder-style address on the main hostname;
- by hostname, using the
dnssetting so that a separate hostname leads directly to that domain's login page.
A configuration with a default domain and a second, branded domain might look like this:
"domains": {
"": {
"title": "MeshCentral"
},
"devbox": {
"dns": "devbox.yourdomain.example",
"title": "DevBox",
"title2": "Test",
"newAccounts": false
}
}
Managed service providers use this pattern to give each client a portal with its own name and branding, while running only one server. Remember that every hostname used must be covered by the server's certificate.
Customising the Look and Feel
Beyond titles, MeshCentral supports further branding, including custom images in the header, a custom footer and adjustments to the login page. Organisations often use these options so that staff and customers recognise the portal as their own support tool. Keep branding honest, however; a self-hosted portal should never imitate another organisation's identity.
Editing the File Safely
A typing error in config.json can stop the server from starting, and an overly strict setting can lock everyone out. A careful routine avoids both.
- Back up first. Copy the current file before every change.
- Change one thing at a time. Restart and test after each change, so you know which edit caused any problem.
- Validate the JSON. A missing comma or an extra trailing comma is the most common cause of a server that refuses to start. Run the file through a JSON validator or a code editor that highlights errors.
- Watch the startup output. MeshCentral reports configuration problems when it starts, often naming the setting involved.
- Keep a way back in. When tightening login restrictions, keep an active session open in another browser until you have confirmed that you can still sign in.
Common Configuration Mistakes
- Leaving
newAccountsenabled on an internet-facing server. - Setting
userAllowedIPso narrowly that administrators are locked out when their address changes. - Forgetting to add new domain hostnames to the certificate.
- Configuring TLS offloading without supplying the proxy's certificate through certUrl.
- Storing a database password in the file and then sharing the file for troubleshooting without removing it.
- Copying settings from old articles without checking that they still exist in the current release.
Settings Worth Reviewing on Every New Server
When a new server is built, a short review of config.json pays for itself many times over. Check that the hostname in the cert setting is the name users and agents will actually use. Confirm that newAccounts is false once the administrator exists. Set sensible password requirements and consider forcing two-factor authentication. Add an idle session timeout. Enable automatic backups and set a backup password. Choose the correct network mode with WANonly or LANonly. If a proxy is involved, confirm that the offload, trusted proxy and certificate settings are all present.
These few lines cover the majority of real-world security and reliability issues seen on self-hosted servers, and reviewing them takes only minutes.
Keeping Configuration Under Version Control
Treating config.json like source code brings real benefits. Storing a copy in a private version control repository records who changed what and when, makes it easy to compare a working configuration with a broken one and allows a known-good version to be restored instantly. Before committing, remove or replace secrets such as database passwords and backup passphrases, or keep them in a separate secrets store that the server reads at startup. Even without a formal repository, keeping dated copies of the file before each change achieves much of the same benefit.
Reading Startup Messages After a Change
After every edit and restart, read the first lines the server prints. MeshCentral reports which ports it has bound, whether it is offloading TLS, which database it has connected to and whether it found any settings it does not recognise. An unrecognised setting usually means a spelling mistake or an option that belongs in a different section, such as a domain setting placed under settings. Catching these messages immediately is much easier than discovering weeks later that a security option never took effect.
Comments and Documentation Inside the File
Standard JSON does not allow comments, which can make a complex configuration hard to understand months later. The underscore convention offers a practical workaround: a key such as an underscored note can hold a short explanation that the server simply ignores. Used sparingly, this keeps the reasoning behind unusual settings right beside the settings themselves.
Frequently Asked Questions
It is config.json inside the meshcentral-data folder, created the first time the server runs.
No. The server reads config.json at startup, so restart the service or container after editing it.
MeshCentral ignores keys that begin with an underscore, which is a convenient way to keep a setting in the file while disabling it.
Yes. Each entry under domains is an independent portal with its own users, devices and branding, reached by path or by its own hostname.
The most common cause is invalid JSON, such as a missing or extra comma. Validate the file and check the startup messages.
Use userAllowedIP in the relevant domain to allow only specific addresses or networks, and keep a session open while testing.
Conclusion
MeshCentral's config.json is compact but remarkably powerful. A few lines in the settings section define how the server listens, which database it uses and how it is backed up, while the domains section shapes what users see and how securely they sign in. Domains even let one server act as many independent portals. Edit the file carefully, one change at a time, validate it before every restart and protect it like the certificates beside it. Mastering this one file gives you control over almost every aspect of the platform.