bitnami / vms

Bitnami VMs
https://bitnami.com
Other
207 stars 44 forks source link

[LAMP] set bitnami apache php process to run with umask 002 #1724

Open tacoma50 opened 1 week ago

tacoma50 commented 1 week ago

Describe your issue as much as you can

I created a Google VM by going to the Google Marketplace and creating a new BITNAMI PACKAGE FOR LAMP VM at: https://console.cloud.google.com/marketplace/product/bitnami-launchpad/lampstack

How do I configure the Bitnami apache and PHP processes to run with a umask of 002 so files are created with 0664 and folders with 0775.

jotamartos commented 4 days ago

You could change the start.sh scripts under /opt/bitnami/scripts/COMPONENT to set the umask before running the process or you can create a home folder for the daemon user and configure the profile.

https://serverfault.com/questions/166176/ways-to-set-umask-on-ubuntu-for-daemon-processes https://unix.stackexchange.com/questions/703111/modify-umask-of-a-running-process

Please note that these questions are admin-related ones and it's out of the scope of this support forum. Please check the information available online to know how to set the umask of a running process.

tacoma50 commented 14 hours ago

Hi Thank you. I tried your suggest as shown here but it did not work:

=== vi /opt/bitnami/scripts/apache-env.sh and added these 2 lines: ===

- set umask of 002 so DIR=775 and FILES=664

umask 0002

=== restart server === /opt/bitnami/ctlscript.sh stop /opt/bitnami/ctlscript.sh start

=== get httpd process ID === $ps -aef |grep httpd 5 S www-data 40685 40675 0 80 0 - 401375 pipe_r 17:51 ? 00:00:00 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf

=== check the umask of a running proccess id =========== root@test1:/data/etc/logs/test# grep -i umask /proc/40675/status Umask: 0022

as you can see the umask is still 0022 and not 0002

=== I even adding this line to bitnami.apache.service did not work ======= vi /etc/systemd/system/bitnami.apache.service

[Service] UMask=0002