0

I can't figure out how to merge nxginx and sftp user for a folder.

So for example I have folder: /var/www/domain.com/uploads

sftp user is: john

john belongs to group: sftpuser

  1. scenario with chown nginx:nginx

from web interface I can upload files to uploads folder. But the issue that when I login through sftp it doesn't have rights to upload any file to that upload folder.

  1. scenario with chown john:sftpuser

from web interface I can't upload files to uploads folder. But when I login through sftp I am able to upload files to uploads folder.

Any ideas and what the proper way to configure this?

Thank you in advance!

1 Answer 1

0

Both scenarios are incorrect.

The only true logical and secure way to run NGINX/PHP-FPM website is by running the website with a separate user (can be your existing SFTP user), and having it own all website files and dirs as in chown example:example for all files and directories.

See here for more details. Particularly, the important step in this setup is making nginx user to be a member of the website's user group:

usermod -a -G example nginx
1
  • Thank you will try to follow your guide.
    – andys
    Feb 11, 2021 at 8:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .