Answer the question
In order to leave comments, you need to log in
How to set permissions when executing an external program from under Apache?
Hello. I'm just getting started, so my questions may seem simple. But I've been struggling with this problem for a few days now and have come to a dead end.
In short, the problem is that an external program called from a php script does not work the same as if it is called from the console via ssh, moreover, the execution occurs under the same user.
From the console via ssh I go from under myusername (not root) and execute:
$cd /var/www/myusername/data/www/mysitename/tmp
/var/www/myusername/data/www/mysitename/tmp$ /usr/bin/pdflatex myfile.tex
$pipes = array();
$options = array();
$cmd = '/usr/bin/pdflatex myfile.tex';
$cwd = '/var/www/myusername/data/www/mysitename/tmp';
proc_open( $cmd, $options, $pipes, $cwd );
#!/bin/sh
echo Content-type: text/html
echo
cd /var/www/myusername/data/www/mysitename/tmp
/usr/bin/pdflatex myfile.tex
Answer the question
In order to leave comments, you need to log in
The script is executed with apache rights. That is, if your apache is running from the wwwroot user or the like, then the scripts are run from the same user.
Give more rights to this user. Just keep in mind that anyone else who visits your site, for example, a potential pest, will be able to get the same rights.
1. try to run Apache with fastCGI, in this case you can set both the user and the group for each site, without any special keys, and don't forget to add it to group 0, which is not really feng shui.
2. option use non-standard file permissions, in particular
linuxsoid.com/blog/standartnye_prava_unix_suid_sgi...
read immediately about
SUID, SGID and Sticky Bits
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question