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



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

<Tabs items={['Via Startup (Recommended)', 'Via serverconfig.txt']}>
  <Tab value="Via Startup (Recommended)">
    <Steps>
      <Step>
        Open Startup [#open-startup]

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

      <Step>
        Set the Password field [#set-the-password-field]

        Find the **Password** field and enter your password.
      </Step>

      <Step>
        Restart [#restart]

        Restart from **Console** to apply.
      </Step>
    </Steps>
  </Tab>

  <Tab value="Via serverconfig.txt">
    <Steps>
      <Step>
        Stop the server [#stop-the-server]

        Go to **Console** and stop your server.
      </Step>

      <Step>
        Open serverconfig.txt [#open-serverconfigtxt]

        Click **Files** in the sidebar and open `serverconfig.txt`.
      </Step>

      <Step>
        Set the password [#set-the-password]

        ```
        password=YourPassword
        ```

        For a public server, leave it empty:

        ```
        password=
        ```
      </Step>

      <Step>
        Save and start [#save-and-start]

        Click **Save Content** and start from **Console**.
      </Step>
    </Steps>
  </Tab>
</Tabs>

How Players Connect [#how-players-connect]

Players are prompted for the password when they try to join:

1. Click **Multiplayer** > **Join via IP**
2. Enter the IP and port
3. When prompted, enter the password

Passwords are **case-sensitive**. Avoid spaces if possible — some clients can have issues with them.

Tips [#tips]

* Share the password through a private channel (Discord, etc.) — never publicly
* Combine with [Terraria's anti-cheat](/docs/terraria/disable-anti-cheat) on competitive vanilla servers
* If you need stronger access control, use the password **plus** the server's `secure=1` setting in `serverconfig.txt`

Related Guides [#related-guides]

* [Server Configuration](/docs/terraria/server-config)
* [Connect to Your Server](/docs/terraria/join-server)
