Posted on 05-25-2018 07:43 AM
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
Solved! Go to Solution.
Posted on 05-29-2018 08:07 PM
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.
Posted on 05-29-2018 08:07 PM
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.
Posted on 02-23-2023 04:43 AM
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.