I have a web application where I create some folders on my server and put executables there. Then I try to run them with chroot but I get a message that access is denied there.
chmod -R 777 blah blah.... and then I get a message that the folder or the file that I call (sudo chroot mydirectory myfile_inside_Mydirectory) does not exist. This happens only when I call chroot on folders created by the web server. My web application is in php and I use:
shell_exec("cp -R /var/www/comp/prison/bin $dir"); shell_exec("cp -R /var/www/comp/prison/lib $dir"); shell_exec("cp /var/www/janitor.out $dir/janitor.out"); shell_exec("sudo chmod -R 777 $dir"); $process = proc_open("sudo chroot $dir janitor.out", $descriptorspec, $pipes);
sudo does not need password.