First of all Hello to all,
A special situation occurred on our server, we want to access another domain files from a specific domain. suppose that we have two domain, former is www.aaa.com which host its files on /home/aaa/domains/aaa.com/publich_html and latter www.bbb.com which host its files on /home/bbb/domains/bbb.com/publich_html. On aaa domain we have a PHP script (called test.php) that open a text file in /home/bbb/domains/bbb.com/public_html/files/test.txt, when we execute test.php from browser, "failed to open stream: Permission denied".
Notes:
1. We access aaa domain via IP, It means we execute test.php script as follow: [IP_OF_SERVER]/~aaa/test.php. I read here http://wiki.amservers.nl/Mod_ruid2, when you access the domain via IP, mod_ruid2 doesn't work.
2. As you know, a new user and a new group with a same name as domain create when you define new domain in directadmin, so for this scenario, we have aaa user and aaa group, also bbb user and bbb group. I add aaa user to bbb group and bbb user to aaa group. But no effect.
3. Check permission for test.txt to 777, but again no effect.
4. test.php script is something like this:
Line 1, 'whoami' command send back 'aaa' (User who execute this script)
5. We give a SSH access to aaa user, then we login to SSH via aaa user and execute test.php script, amazing! script executed successfully and test.txt content returned to screen.
6. Maybe you say what a dummy scenario, but we have no way! aaa domain is a repository that used by our Android application that developed and published to all. So we couldn't change these settings, we must adapt with this constraint.
Thanks for your patience and also HELP ;-)
A special situation occurred on our server, we want to access another domain files from a specific domain. suppose that we have two domain, former is www.aaa.com which host its files on /home/aaa/domains/aaa.com/publich_html and latter www.bbb.com which host its files on /home/bbb/domains/bbb.com/publich_html. On aaa domain we have a PHP script (called test.php) that open a text file in /home/bbb/domains/bbb.com/public_html/files/test.txt, when we execute test.php from browser, "failed to open stream: Permission denied".
Notes:
1. We access aaa domain via IP, It means we execute test.php script as follow: [IP_OF_SERVER]/~aaa/test.php. I read here http://wiki.amservers.nl/Mod_ruid2, when you access the domain via IP, mod_ruid2 doesn't work.
2. As you know, a new user and a new group with a same name as domain create when you define new domain in directadmin, so for this scenario, we have aaa user and aaa group, also bbb user and bbb group. I add aaa user to bbb group and bbb user to aaa group. But no effect.
3. Check permission for test.txt to 777, but again no effect.
4. test.php script is something like this:
PHP:
echo exec('whoami');
$myfile = fopen("/home/bbb/domains/bbb.com/files/test.txt", "r");
var_dump(error_get_last());
echo fread($myfile,filesize("/home/bbb/domains/bbb.com/files/test.txt"));
fclose($myfile);
5. We give a SSH access to aaa user, then we login to SSH via aaa user and execute test.php script, amazing! script executed successfully and test.txt content returned to screen.
6. Maybe you say what a dummy scenario, but we have no way! aaa domain is a repository that used by our Android application that developed and published to all. So we couldn't change these settings, we must adapt with this constraint.
Thanks for your patience and also HELP ;-)