Can I set the user manually, instead of 'caddy', for compiled deb files

1. Caddy version (caddy version):

2.4

2. How I run Caddy:

service caddy start

a. System environment:

21.04 Ubuntu (caddy deb file downloaded from your official repo)

I want to know if I can set any option in the caddyfile or elsewhere that determines which user caddy will run under.

Right now, it runs under the ‘caddy’ user, which is creating a lot of file permission conflicts, as the caddy server is a reverse proxy, and the origin server creates everything under the user www-data. Some of this content has to be accessed by caddy, such as image files.

If I can run caddy under www-data as well, these file conflicts would not arise.

This is typical for the files:

-rw-r--r-- 1 www-data www-data 

parent folder  -- drwxr-Sr-- 2 www-data www-data

UPDATE: Adding ‘caddy’ to the group ‘www-data’ DID NOT help.

I was able to run caddy using www-data by doing

systemctl edit --full caddy

However, would this not be reverted when I do apt update next time with a new version of caddy?

Also, this is not an issue, for some reason, on Rocky Linux. On it, the owner of many files are automatically changed by the OS to ‘tape’ on being received by rsync, and I have no idea why. PHP files are left alone, though.

1 Like

Using systemctl edit is the correct approach, it will persist across updates.

We’re working on an update to our documentation that will further elaborate on this. The pull request being worked on is here, if you’d like to read it now:

The .deb should be adding the caddy user to the www-data group though, so it shouldn’t be an issue for you.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.