Saturday, April 30, 2016

mount / and / or apache - php permissions : where should I look?




Here's the configuration :



The directory :



/var/www/mount_ImpExp/ImpExp/



is a shared directory (Linux) from a PC with an IP adress 192.168.1.12



My PC IP adress is 192.168.1.11




I mounted that shared dir with the command :
mount -t cifs -o auto,username=myusername,password=mypass //192.168.0.12/LINUX_U /var/www/mount_ImpExp



If I try to manually launch a rsync with :



rsync -t /var/www/mount_ImpExp/ImpExp/compteur_assur /usr/bin/



This works :



ls -al /usr/bin/compteur_assur

-rwxr-xr-x 1 zobz zobz 2501 2009-06-09 15:44 /usr/bin/compteur_assur


Now I create a exec.php file in my website : the path is :
/var/www/html/Internet/mywebsite



the source is :




echo date('d/m/Y H:i:s');
echo "
";

var_dump(
system("rsync -t /var/www/mount_ImpExp/ImpExp/compteur_assur /usr/bin/"));


it doesn't work.



In the php.ini the "safemode" is "off". So I may be able to execute any shell command.
If I try to modify the exec.php file and do a simple :

var_dump( system("ls -al ."));
file


It works. So the "system" call works.



Thus I tried to modify the options in the httpd.conf file :





# Ajout Olivier Pons / 11 juin 2009

AddDefaultCharset UTF-8
Options All

AllowOverride All
Order allow,deny
Allow from all




I then restarted the server and nothing works.
What shall I do where should I look next ? I'm stuck...


Answer




Okay I found the problem : it a "permission problem" (or "rights problem" I don't know how to say it in English, sorry)




[Batman]:/var/www/html/Internet/mywebsite# chown apache:apache /var/www/mount_ImpExp/
chown: changing ownership of `/var/www/mount_ImpExp/': Permission denied
[Batman]:/var/www/html/Internet/mywebsite# chmod o+r /var/www/mount_ImpExp/
chmod: changing permissions of `/var/www/mount_ImpExp/': Permission denied
[Batman]:/var/www/html/Internet/mywebsite#

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...