A common use case is to put a second hard disk on the server, create a backup folder there and have a scheduled script copy over some files regularly from the documents folder to the external hard disk. You may get a permissions errors. But you can simply solve this by explicitly giving right permissions to the folder to make it accessible for FileMaker server scripting process executing plugin functions.
So let's talk about those accounts. There are various accounts used on a FileMaker Server when working with network shares or folders on disks.
- The account your script is logged in to the FileMaker Server, e.g. admin account. Or let's say better a limited account named "backup", which may not need to access all tables in all files. You can query this name with Get(AccountName) in your script.
- The account the FileMaker server runs on the system. For MacOS this is usually a separate user named fmserver. You can query this name with MBS( "SystemInfo.UserName" ) function.
- The account you login to a remote file server to mount the network share. This may just be a normal login name or with a domain controller something like "SRV2012\bob".
- The account of the local admin, who logs into the server to see the desktop.
If a script running under the account "backup" (1) on the FileMaker server tries to write to the network share, it only has the permissions of the FileMaker Server scripting process (2). Access is denied as the network share is mounted exclusively for the local admin (4).
There are two solutions:
- You can mount a network share both on MacOS and Windows to allow access for all users. This can be tricky and there are various tutorials on the web.
- You can use MBS Plugin with Files.Mount function to have your script mount the network share itself, do its business and then unmount it via Files.Unmount function.
If you have questions, please do not hesitate to contact us.