-
-
Save andrew-stclair/0a59b056058e7a3d0083c867975b15d2 to your computer and use it in GitHub Desktop.
Valheim dedicated server systemd unit file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make sure to adjust ALL paths and user/group in the service file (also the ones under "Security and Sandboxing") | |
[Unit] | |
Description=Valheim dedicated server | |
Wants=network-online.target | |
After=syslog.target network.target nss-lookup.target network-online.target | |
[Service] | |
Environment="LD_LIBRARY_PATH=/home/steam/servers/valheim/linux64" | |
User=steam | |
Group=steam | |
WorkingDirectory=/home/steam/servers/valheim/ | |
#StandardOutput=null | |
# longer start timeout to allow steamcmd to download updates before starting the server | |
TimeoutStartSec=600 | |
ExecStartPre=/home/steam/steamcmd +login anonymous +force_install_dir /home/steam/servers/valheim +app_update 896660 +quit | |
# for different data path use -savedir path | |
ExecStart=/home/steam/servers/valheim/valheim_server.x86_64 -name "SERVERNAME" -port 2456 -world "WORLDNAME" -password "PASSWORD" | |
KillSignal=SIGINT | |
Restart=on-failure | |
RestartSec=5m | |
# Security and Sandboxing | |
NoNewPrivileges=yes | |
PrivateTmp=yes | |
PrivateDevices=yes | |
ProtectKernelTunables=yes | |
ProtectKernelModules=yes | |
ProtectControlGroups=yes | |
ProtectSystem=strict | |
ProtectHome=read-only | |
SystemCallFilter=~@mount | |
ReadWritePaths=/home/steam/servers/valheim | |
ReadWritePaths=/home/steam/.config | |
ReadWritePaths=/home/steam/.steam | |
ReadWritePaths=/home/steam/steamcmd | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment