I am currently trying to do a backup of a server and am getting an error message when running my script. The script runs correctly on certain directories, but for the directory I am attempting to use I get the error message "permission denied", even with proper access.

For example, when trying to create the backup in the /var/... directory using my script, it works.
However, if I attempt to run the script in the /opt/app/backup directory I am not able to: Permission denied

I also have the correct read/write access for the directory, compare /var and /opt: Access comparison of var and opt
Any help/suggestions are greatly appreciated.


Ok, so I solved the problem!

When I looked a little deeper into the actual access I had, it was only of degree 755: Only the owner had write access to the directory!

To fix the problem, I simply did sudo chmod 777 -R /opt and this allowed the script to write to the directory. Once the backup script ran, I changed the permissions back to their default state.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.