Issue mounting mounting SMB share via Jamf

tfenna
New Contributor II

Happy Friday everyone!

I'm sure that I'm probably missing something very obvious to the right person... My experience with bash is currently limited (hopefully not for too long!).

I'm trying to mount an SMB share using the below script, there is more to the script, however I've removed it as I know the issue lies in this part.
If I run the below locally on my machine replacing $3 with $USER the script works perfectly and the Apps share maps straight away.

#!/bin/bash

    mkdir /Users/$3/Apps

        mount -t smbfs //userName:userPassword@myServer/Apps /Users/$3/Apps

As soon as I deploy the above from the JSS and perform Sudo Jamf Policy on the targeted machine it creates the directory Apps and somewhat mounts the drive. The directory stays as just a folder and does not change to the intended SMB share, as soon as you click in it the folder then disappears and takes you up a level.

If I run df in terminal you can see the SMB share is mapped to the folder created, run ls and you see the directory listed also, then... if I try opening the directory in Finder it says it does not exist! Apologies, had to redact a few lines as they contained personal information.

WIM-0230:~ $ df
//userName@myServer/Apps    /Users/userName/Apps

WIM-0230:~ $ ls
Applications        Documents       Library         Music
Desktop         Downloads       Movies          Pictures        Apps        package-lock.json

WIM-0230:~ $ open Apps
The file /Users/userName/Apps does not exist.

What's going on? Help!

Thank you

1 ACCEPTED SOLUTION

Look
Valued Contributor III

My suggestion is get Applscript to do it with a osascript call, if you do this as the currently logged in user it gets done by the Finder as them and is all clean and nice and even gets cleaned up when they log off as well.
Something like.

sudo -u $Current_User osascript -e 'mount volume "user@server/share"'

EDIT: You don't need to make mount points or anything either, it does all this for you.

View solution in original post

2 REPLIES 2

Look
Valued Contributor III

My suggestion is get Applscript to do it with a osascript call, if you do this as the currently logged in user it gets done by the Finder as them and is all clean and nice and even gets cleaned up when they log off as well.
Something like.

sudo -u $Current_User osascript -e 'mount volume "user@server/share"'

EDIT: You don't need to make mount points or anything either, it does all this for you.

10PAR35H10
New Contributor II

Tried it with appropriate user@server/share  but no go 

In our case We are facing error - could not mount distribution point "jamfShare" 

Also when df command executed we can see our File Share Distribution Point - Mounted.