Granting GitLab Runner Directory Access on AlmaLinux Print

  • 0

This guide provides the necessary steps to grant the GitLab Runner user the correct file system permissions to access project directories.


1. Grant Group Membership

To allow the GitLab Runner to access project files, you must add its dedicated user, gitlab-runner, to the same group as the project's owner (in this case, enlivendev).

  • Run the following command to add the runner to the group:Bash

    sudo usermod -aG enlivendev gitlab-runner


2. Set Directory Permissions

Next, ensure the permissions on the project directory are set correctly to allow group access.

  1. Set Ownership: Confirm the directory is owned by the user and group.Bash

    sudo chown -R enlivendev:enlivendev /home/enlivendev

  2. Set Permissions: Apply 775 permissions recursively. This allows the owner and group members (including gitlab-runner) to read, write, and execute files, which is necessary for the runner to operate correctly.Bash

    sudo chmod -R 775 /home/enlivendev


3. Install and Start the Runner Service

If you haven't already, install the GitLab Runner as a systemd service and ensure it's running.

  1. **Install the service:**Bash

    sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner

  2. Enable and start the service: This ensures the runner starts automatically on boot.Bash

    sudo systemctl enable gitlab-runner sudo systemctl start gitlab-runner


4. Verify the Setup

Finally, check that the runner service is active and properly connected to your GitLab instance.

  1. **Check the service status:**Bash

    sudo systemctl status gitlab-runner

    • Look for Active: active (running) in the output.
  2. **Verify the connection to GitLab:**Bash

    sudo gitlab-runner verify

    • The output should show that the runner is valid and connected.

Your GitLab Runner is now fully configured with the necessary permissions to access and manage files within the /home/enlivendev directory, ready to execute CI/CD jobs.


Was this answer helpful?

« Back