How can I change the Caddy sevice user and group to nobody and nogoup?

1. Caddy version (caddy version):

2.1

2. How I run Caddy:

echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \

    | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list

sudo apt update

sudo apt install caddy

That’s it.

a. System environment:

Ubuntu 20.04

No docker

b. Command:

I’m just starting caddy with below command.

caddy start

c. Service/unit/compose file:

I am using it as default setting.

d. My complete Caddyfile or JSON config:

:80
root * /usr/share/caddy
file_server

3. The problem I’m having:

4. Error messages and/or full log output:

I am using openlitespeed web server, I would like to use user and group like that.

Openlitespeed web server uses nobody and nogroup, and php7.4-fpm uses the same settings.

I need to use the same user and group for reverse proxy setting, please tell me how to do it.

5. What I already tried:

I don’t know how to change it.

It entirely depends on how your installed and are running Caddy.

You didn’t fill out the thread template, so we don’t know anything about your environment.

I just filled in the form. How can I solve the problem?

1 Like

Howdy @WoosungChoi,

Since you just run it from the command line, and that method simply inherits the user and group of the person who runs it, you can use sudo for this purpose.

sudo, sudoedit - execute a command as another user
https://linux.die.net/man/8/sudo

Probably something like sudo -g nogroup -u nouser caddy start would be appropriate. Run man sudo on your machine for more detailed usage info.

1 Like

Wow great! I’ll try it!

When I gave this command,

sudo -g nogroup -u nobody caddy start

caddy produced this result.

permission denied start: caddy process exited with error: exit status 1

It would be better to just change the user of php-fpm. Thanks.

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