Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 1.51 KB

group-file-system-access.md

File metadata and controls

64 lines (47 loc) · 1.51 KB
  1. Create a new group named valheim:
sudo groupadd valheim
  1. Add your current user to the valheim group:
sudo usermod -a -G valheim $USER
  1. Verify that the group was created and your user was added successfully:
groups $USER
  1. 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.

  1. 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
  1. 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.

  1. 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.