Question

I've mounted an afp directory, afp://ServerName/Foo/, with "Finder->Go->Connect to Server" to /Volumes/Foo, now I'm trying to access it with:

opendir("/Volumes/Foo/dirname/");

However, I get an

Warning: opendir(/Volumes/Foo/dirname/) [function.opendir]: failed to open dir: Permission denied in...

mount in terminal gives me: afp_1VqvPY000e413wKcJE13gANY-7.2d000004 on /Volumes/Foo (afpfs, nodev, nosuid, mounted by daniel)

So I need to mount the folder as _www, or somehow allow _www to use my mount. How can I do either one of these? I'm guessing I want to possibly su to _www or something, but I don't know how to with terminal.

Was it helpful?

Solution

Should be able to mount the volume as _www in the terminal.

sudo -u _www mount_afp -I //user@host/share /path/to/mountpoint.
Omit -I if you want to specify the password in the URI.

Either that or you could use mount_afp using system() or exec() from within the script.

If it is for a web server you will probably want to look into automatically mounting the share at startup.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top