Mounting Network Drives Via Config Profile macOS 10.13.0

AntD
New Contributor III
New Contributor III

I'm fairly new to Jamf but worked for some time with Mac management but tonight Ive spent far too long figuring out how to make this work without any luck.

In other MDMs Ive simply used a config profile to put at the network share I want to mount at login and off we go.

I did this in Jamf and it just didn't make a difference, nothing happened at all. I confirmed that the machine in question had received the config profile.

I then tried to create this using a log in hook using this script that I have found in another post

#!/bin/sh

protocol="smb" # This is the protocol to connect with (afp | smb)
    echo "Protocol: $protocol"
serverName="bc-jupiter"   # This is the address of the server, e.g. my.fileserver.com
    echo "serverName: $servername"
shareName="media"    # This is the name of the share to mount
    echo "shareName: $sharename"

# Mount the drive 
    mount_script="$(/usr/bin/osascript << EOT
    tell application "Finder" 
    activate
    mount volume "${protocol}://${serverName}/${shareName}"
    end tell
EOT)"

exit 0

Worked fine when ran through terminal.

When I added it to the log in hook in didn't work how I expected. It appeared to try and mount the drive during log in and I got a keychain error (seems as though it hadn't loaded yet) and the drive didn't mount. Why keychain? This device is a test device and its joined to a domain currently

Ive ended up using Automator to create an app to run the script and adding that app to the log in items through a config profile.

It all works now but seems a long way round, particularly when theres a payload for this in the config profiles!

Has anybody else seen this? Im using Jamf Pro 10 and macOS 10.13.0

1 REPLY 1

sdagley
Esteemed Contributor II

@antdarlow When you're running a script from a Jamf policy it runs as root. You need your script to run as the logged in user, and you'll find it's a popular topic on Jamf Nation. This tread would be a good one to start with: Help running login script as user