# How to Set a Password on Your Valheim Server (/docs/valheim/server-password)



import { Step, Steps } from 'fumadocs-ui/components/steps';

Valheim servers require a password by default. There are two important rules:

1. The password must be **at least 5 characters**
2. The password **cannot match the world name** — Valheim will refuse to start if it does

<Steps>
  <Step>
    Open Startup [#open-startup]

    In the [XGamingServer Panel](https://panel.xgamingserver.com), click **Startup** in the sidebar.

    {/* Screenshot needed: Startup tab with Server Password variable */}
  </Step>

  <Step>
    Change the Server Password [#change-the-server-password]

    Find the **Server Password** variable (maps to `-password`) and enter your password.

    ```
    MySecretPass
    ```

    The password must be at least 5 characters and **must not match** the world name set in the **World** variable.
  </Step>

  <Step>
    Restart the server [#restart-the-server]

    Go to **Console** and restart.
  </Step>
</Steps>

Removing the Password [#removing-the-password]

Valheim does not officially support password-less servers — the server will refuse to start without a password. If you want a public-feeling server:

* Use a simple, well-known password and share it openly
* Combine with `-public 1` so it appears in the Community browser
* Or use the [join code](/docs/valheim/join-server) approach for crossplay servers

Common Errors [#common-errors]

| Error                         | Cause                                        | Fix                                          |
| ----------------------------- | -------------------------------------------- | -------------------------------------------- |
| "Password too short"          | Password under 5 characters                  | Use at least 5 characters                    |
| "Password matches world name" | `-password` and `-world` are the same string | Make them different                          |
| Server won't start            | One of the above                             | Check **Console** output for the exact error |

Related Guides [#related-guides]

* [Server Launch Parameters](/docs/valheim/server-launch-parameters)
* [Connect to Your Server](/docs/valheim/join-server)
* [Make Server Private](/docs/valheim/private-setup)
