Skip to main content
Question

Issues using policy with mount AFP script

  • January 30, 2014
  • 2 replies
  • 30 views

Forum|alt.badge.img+4

We have the following script running under a policy at startup and it works great.

#!/bin/bash
echo "username attempting to mount a share"

# Mount share
sudo -u username /usr/sbin/jamf mount -server servername -share sharename -type afp -username username -password password

Problem is that if we happen to login as any user, then logout, for some reason the mount goes away. Anyone know why? Is it OS X doing this? Anyway around it? Do I have to create a logout policy to remount it?

Thanks.
Mark

2 replies

Forum|alt.badge.img+16
  • Honored Contributor
  • January 30, 2014

Hey @mhatch14

Pretty sure this is an OS X issue. Think you need to change a preference file:

sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool YES


Forum|alt.badge.img+4
  • Author
  • Contributor
  • January 31, 2014

I think you're right that it's an OS X issue. The issue being that when a user logs off, all processes related to that user, including volumes mounted via AFP, are ended.

In this case, I use Casper to mount an AFP volume as a user at startup. So even if no one logs in, the machine mounts this volume via AFP. Even if I login, the volume stays mounted. The moment I logout then the volume goes away. This is the behavior that I don't want.

I would like the volume to stay mounted.

I did try the preference that you sent me and unfortunately it did not change the behavior.

Thanks.
Marl