I've got a bit of a complicated setup going on here, and, well, it's not quite working. I have a Python script that parses a directory for certain "attributes" in the directory name (how the script works isn't necessarily important - it runs just fine). This script is called via the system() command in PHP (running on an Apache webserver on CentOS 6.2). My issue lies in the fact that the directory I'm attempting to search with the Python script is an SSHFS share. I can run my script just fine from a terminal (as myself), but when I run it in PHP I get the following error as output:

Traceback (most recent call last): File "../rpm-viewer/getRunsList.py", line 20, in os.chdir(rpmdir) # change the working directory OSError: [Errno 13] Permission denied: '/mnt/rpm'
Script Exit Status: 1

(The "Script Exit Status" code comes courtesy of the return_var parameter in PHP's system() function.)

I also tried creating a symbolic link to my mountpoint and accessing it via Apache (just using the web browser), but again I get a 403 error.

My SSHFS share was established with the option allow_other enabled, however, if it matters, the share created is/must be read-only.

Is there any way I can possibly access my SSHFS share via Apache/my PHP-called-Python script?


Well, the error tells you exactly what's wrong:

OSError: [Errno 13] Permission denied: '/mnt/rpm'

Change the permissions on that directory. I believe that Apache runs as apache on CentOS, which will most likely be the other permissions (e.g., chmod -R o+rX /mnt/rpm).

You also need to have execute permission on the entire path from the root in order to reach the leaf level.

  • Yes, I know the problem is that permission is denied (further confirmed by the 403 error when I tried to access the symblink-pointed directory directly in a web browser). Your solution would seem logical other than the fact that the share is mounted read-only. Issue the chmod you provided (or any chmod, actually) just nets me the error chmod: changing permissions of /mnt/rpm': Read-only file system` . For the record, the ls -l of mnt appears as: drwxr-sr-x. 1 1209 1200 4096 Jul 6 13:27 rpm. I guess what I'm trying to see at this point is: are there any workarounds to this situation? – Devin Jul 6 '12 at 18:08

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.