File Permissions when running under FMS
A good method for testing some plugin functionality for FileMaker Server scripting, is to run it in the client first. But permissions on the server will always interfere with the functionality on server, as the plugin runs a the "fmserver" user, which has very few permissions on the drive.
Restrict file operations to the FMS Documents folder.
If you keep all your file operations inside the FMS Data/Documents folder, there will be no permissions issues. The fmserver user can read and write to this folder with no issues. Setup other processes that either drop or read files inside that folder if you need to interact with other apps.
Use the BE_LastError function every time you call a plugin function. A permissions issue with a file operation will be BE_LastError 13. This is for things like CreateFile or writing to disk. Be aware too, that often you will get a True result from the BE_FileExists function, but not be able to write to that folder.
Writing outside the FMS folder
You will need to add the fmserver user to any folder that you want to write to. But also you will need access to READ from any of the parent folders. For example if you want to create a file inside this path :
Then the fmserver user needs read access to /Base and /Base/Docs and write access to /Base/Docs/March