Suppose my bash file contains
chmod -R 777 $backup_files/app/webroot/uploadedFiles/
It works fine when I run it through root permission using /permission.sh but when I try to run this bash script via java code like
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("/permission.sh");
printBufferedReaderOutputFromProcess(process);
process.waitFor();
It gives me the following error:
chmod: changing permissions of `/home/app/webroot/uploadedFiles/A.jpg': Operation not permitted
What can I fix it?