- Create a new group named
valheim
:
sudo groupadd valheim
- Add your current user to the
valheim
group:
sudo usermod -a -G valheim $USER
- Verify that the group was created and your user was added successfully:
groups $USER
- Find the group ID (GID) of the
valheim
group:
getent group valheim
This command will output something like valheim:x:1001:
, where 1001
is the GID.
- Set the permissions for the directories to be group writable, readable, and executable:
sudo chown -R :valheim ./saves ./server ./backups
sudo chmod -R 775 ./saves ./server ./backups
- Update your
docker-compose.yml
file to set the PGID:
Open your docker-compose.yml
file in a text editor and modify it as follows:
version: "3"
services:
valheim:
image: mbround18/valheim:latest
container_name: valheim
environment:
- PGID=1001 # Replace with the actual GID from step 4
volumes:
- ./saves:/home/steam/.config/unity3d/IronGate/Valheim
- ./server:/home/steam/valheim
- ./backups:/home/steam/backups
ports:
- "2456-2458:2456-2458/udp"
restart: unless-stopped
Replace 1001
with the actual GID you found in step 4. You can also dynamically set the PUID using the id -u
command to get your current user ID.
- Restart your Docker Compose services to apply the changes:
docker-compose down
docker-compose up -d
This will recreate the container with the new PGID settings.