Permission denied error on saving file to NAS

I am using a “do shell script” to run an external executable in background. The executable (written in Python) results in a saved file. It all works well normally.

I am trying to direct the executable to save the file on a USB drive that is plugged into my VDSL modem. The modem makes the USB drive visible as an NAS but requires credentials to be established before allowing access - it will not allow ‘guest’ access which is logical. The modem grants access via smb.

Before I start, I mount the USB drive on the Desktop and supply the credentials which gives access to the contents (actually a choice of two volumes both of which are formatted FAT). My macOS user has full read/write access.

When I run the “do shell script” the executable reports a “Permission denied”. I guess that means that although the volume is mounted on my Desktop, it is not accessible to OSAScript unless credentials are supplied. I there a way to supply those credentials in my AppleScript “do shell script” call?


What happens when you mount the volume using the same script using mount_smbfs?

I didn’t know about “mount_smbfs”. I did try “mount -t FAT” but that failed - I misunderstood what was meant by file system.

I’ll give “mount_smbfs” a try.

Many thanks.