PHP Script and correct permissions for user to change everything

apache-2.4file-permissionspermissionsPHPwww-data

The network configuration doesn't allow access to FTP from outside the building. There's one user that need to upload and change files from a specific folder so I've installed TinyFileManager

https://tinyfilemanager.github.io/

  1. Created the folder
  2. Configured tfm.php script with user/pass/etc.
  3. Set folder to 755
  4. Added linux user to www-data
  5. Chown folder -R to user:www-data (including tfm.php)

User still cannot create a sub-folder or new file. Cannot upload and overwrite any file. I've set all files to 644 and sub-folders to 755

Which would be the correct permissions and ownerships so the user can change everything in that folder ? without compromising sec.

Thanks

Best Answer

Your files and folders need write permissions for the group.

That means 775 for folders and 664 for files.

If the server has selinux enabled (most probably not the case on debian, but for completeness) you need to set the correct security context for the files and folders as well.