In shared hosting environments where the web server runs as the same user that owns the web files, I see a security issue.
My hosting provider runs WHM, Cpanel, Cloudlinux and Litespeed. Web files uploaded from SFTP are owner:group of the cpanel owner.
Example using Drupal:
IMO the web server should run as a different user & group, and the file group ownership should be the webservers user group. Then access can be set as -rw-r--r--, allow for modification by the owner, and PREVENT modification by the web server.
What am I missing here? Why would the web server run as the same user as the file owner?
My hosting provider runs WHM, Cpanel, Cloudlinux and Litespeed. Web files uploaded from SFTP are owner:group of the cpanel owner.
Example using Drupal:
Bash:
-r--r--r-- 1 nonyabid nonyabid 6604 Aug 28 15:04 authorize.php
-r--r--r-- 1 nonyabid nonyabid 114096 Aug 28 15:04 CHANGELOG.txt
-r--r--r-- 1 nonyabid nonyabid 1481 Aug 28 15:04 COPYRIGHT.txt
-r--r--r-- 1 nonyabid nonyabid 720 Aug 28 15:04 cron.php
-r--r--r-- 1 nonyabid nonyabid 102 Aug 28 15:04 .drush-lock-update
-r--r--r-- 1 nonyabid nonyabid 317 Aug 28 15:04 .editorconfig
-r--r--r-- 1 nonyabid nonyabid 662 Aug 28 15:04 .gitignore
-r--r--r-- 1 nonyabid nonyabid 6551 Aug 28 15:04 .htaccess
- The litespeed server runs as user "nonyabid"
- To secure the codebase, since the webserver is the "owner" and to prevent a bug in a drupal module from allowing write access to webfiles, owner must be set to R only as above
- With this configuration, files cannot published easily without changing the permissions first to allow owner RW
IMO the web server should run as a different user & group, and the file group ownership should be the webservers user group. Then access can be set as -rw-r--r--, allow for modification by the owner, and PREVENT modification by the web server.
What am I missing here? Why would the web server run as the same user as the file owner?