I've spent days trying to figure this out.
If I run the command below as standard user, from terminal, it works just fine:
mount_smbfs //username:'password'@server.corp.local/subfolder/another%20sub%20folder /Volumes/SOP/
We have some files that are constantly changing on a windows share. To add to the headache, the path has whitespace within it.
The Macs that need access to it aren't on domain (legacy application hold up).
I'm just trying to provide the users access to the share from the desktops and the script should run on login.
I'm running another script prior to this one, which creates the folder on the volume (/Volumes/SOP) with correct permissions to the folder and it is successful.
Here is the script that throws the error in the subject line of this post:
############################
!/bin/sh
currentUser=$(ls -l /dev/console | awk '{ print $3 }')
True_Path=//username:'password'@server.corp.local/subfolder/another sub folder
/usr/bin/su $currentUser osascript -e 'mount_smbfs "'$True_Path'" /Volumes/SOP/'
##############
I've tried modifying the 3rd line by adding '-c' but I still get the same error.
Also tried just running the line without 'osascript -e'
If I replace whitespace with '%20', I get directory not found.
exit
##############
Welp!