Use www-data user a common user to git pull repository

Discussion in 'General' started by cent89, Feb 8, 2023.

  1. cent89

    cent89 New Member

    Hi, I've to install a IspConfig server with 10 domain, one for every client.
    Every domain is a clone of the same git repository.
    I want to use www-data user to clone the repo, so in future I can automate the updates without knowing the user (web1, web2, ...)
    I've set permission to 770 (user and group can read, write ad exec) to /var/www/ . www-data is member of client1 group.
    So, Logged as www-data user, I can't pull the repo:

    fatal: detected dubious ownership in repository at '/var/www/clients/client1/web1/web'
    To add an exception for this directory, call:
    git config --global --add safe.directory /var/www/clients/client1/web1/web


    How I can solve the problem? Is that way (use www-data user instaed of web1) a right way to perform the task?

    Thanks,
    Roberto
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    No. Each website runs under its own user for security reasons, and all files in that site must be owned by the webID user of that site. So undo the permission changes you made for the web directories, and then just take care to run your git command as the correct webID user for each site. One way to run programs under specific users is to use sudo.
     
    ahrasis likes this.

Share This Page