I'm trying to run a Bourne shell script via JAMF Pro policy that:
1. Gathers a bunch of data.
2. Detects the console user.
3. Creates a mount point (e.g. /tmp/foo).
4. Invokes mount_smbfs -N
to mount a network share with the console user's Kerberos credentials, i.e. without prompting the user for a password.
5. Copies the data (from step 1) to the network share.
6. Unmounts the network share.
7. Exits.
The problem is that Step 4 (mounting the network share) fails from within the JAMF Pro policy. Neither su - user
, sudo -u user
, nor launchctl asuser
works — none of these can access the console user's Kerberos credentials (i.e. klist -l
reports no Kerberos tickets), and the mount fails.
All of the above works fine if I run the script from the Terminal window. But the Kerberos tickets remain inaccessible, and therefore the mount fails miserably, when invoked either from an ssh session or via a JAMF Pro policy.
Any ideas on how this can be done? Any alternatives?
Background: The script isn't user specific. It can run as root or even the nobody user. The only need for the console user's session is to mount the network share with the user's Kerberos tickets. Our security people said the script must not prompt the user for a password, and must not hardcode credentials in the script, and frowned on passing parameters (whether encrypted or not) from JAMF Pro to endpoint.