Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Kortez12's avatar

Best Way to Deploy Updates in aaPanel with a Different User

Hello everyone,

I am running an Ubuntu Server 24.04 with aaPanel for easy website management. My project files are located in the following directory:

/www/wwwroot/{projects}

Currently, these files are owned by the www user, which is used by my Apache web server. However, I would like to deploy updates to this directory using a different user, such as my_user.

My requirements are:

my_user should have access to all files within /www/wwwroot/ to make updates.

After deployment, the files should remain owned by the www user to ensure the web server functions correctly.

What is the best way to set this up while maintaining proper permissions and security? Should I use user groups, ACLs, or some other approach?

Thank you for your help!

0 likes
3 replies
LaryAI's avatar
Level 58

To achieve your goal of deploying updates with a different user while maintaining the correct ownership for the web server, you can use a combination of user groups and Access Control Lists (ACLs). Here's a step-by-step guide:

  1. Create a User Group:

    First, create a new group that includes both www and my_user. This will allow my_user to have the necessary permissions to update files.

    sudo groupadd webdev
    sudo usermod -aG webdev www
    sudo usermod -aG webdev my_user
    
  2. Set Group Ownership:

    Change the group ownership of the /www/wwwroot/ directory to the new group webdev.

    sudo chown -R :webdev /www/wwwroot/
    
  3. Set Directory Permissions:

    Ensure that the group has the necessary permissions to read, write, and execute within the directory.

    sudo chmod -R 775 /www/wwwroot/
    
  4. Use ACLs for Fine-Grained Control:

    Set up ACLs to ensure that my_user can write to the directory, and that new files created by my_user will be owned by the www user.

    sudo setfacl -R -m u:my_user:rwx /www/wwwroot/
    sudo setfacl -R -m d:u:www:rwx /www/wwwroot/
    

    The -R flag applies the ACLs recursively, -m modifies the ACL, and -d sets default ACLs for new files.

  5. Deploy Updates:

    Now, my_user can deploy updates to the /www/wwwroot/ directory. After deployment, ensure that the files are owned by the www user:

    sudo chown -R www:www /www/wwwroot/
    
  6. Verify Permissions:

    After setting up, verify that the permissions are correctly applied:

    getfacl /www/wwwroot/
    

This setup allows my_user to deploy updates while ensuring that the web server continues to function correctly with the necessary file ownership and permissions.

Kortez12's avatar

Lary answer is not 100 good for me, maybe we have some people here, that can help me or guide how should I deploy my app?

Please or to participate in this conversation.