Can't write on API folder in development mode unless sudo

System Information
  • Strapi Version: 4.15.0
  • Operating System: Ubuntu
  • Database: Mysql
  • Node Version: 18.18.2
  • NPM Version: 9.8.1
  • Yarn Version: 1.22.19

I’m running Strapi in development mode in a Ubuntu 22.04 machine (azure) and pm2 runs the ecosystem.config.js file to automatically run its configuration. It does work fine but when running it via pm2 it seems I can’t create new fields for my entities. I get this error message:

Error: EACCES: permission denied, open '/srv/strapi/app/src/api/product/content-types/product/schema.json'
error: Invalid schema edition ApplicationError: Invalid schema edition

I’m running this with my current admin user, not root…
If I run this manually with sudo it works well (without pm2), but it shouldn’t be necessary to run with sudo tho.

Which permissions should I give to the API folder in order to run Strapi safely from this development environment?

I have a service user that’s “strapi” and also an “admin” user that runs pm2

These are the blocked folder permissions

drwxrwxr-x 5 strapi strapi 4096 Nov 10 12:38 /srv/strapi/app/src/api