Posted on 06-12-2012 09:42 AM
Not sure if this a JAMF Bug or Feature or an Apple Bug or Feature, but thought I'd throw it into the community for some feedback.
I have login policies enabled for our machines that mounts SMB network shares based on the AD-user. We also have Fast User Switching enabled on our machines.
User #1 logs into their machines, drive mount perfectly. User #2 comes along and fast user switches, logs in to their network account and no drives mount. Doesn't appear to even run the login policy.
Any idea what the cause/reason is? Any help is appreciated.
Posted on 06-12-2012 09:48 AM
Is the script mounting a remote share unique to each user and using as equally unique mountpoints?
J.I.
Posted on 06-12-2012 11:28 AM
"I have login policies enabled for our machines that mounts SMB network shares based on the AD-user. We also have Fast User Switching enabled on our machines.
User #1 logs into their machines, drive mount perfectly."
Where? What path does this mount to?
"User #2 comes along and fast user switches, logs in to their network account and no drives mount. "
Possibly because they would mount on the same paths as User #1?
-Greg
Posted on 06-12-2012 11:32 AM
You can open up Console to check the logs to be sure. The situation that multiple users are trying to mount to the same path sounds more likely in this instance; the error logs will confirm.
Recommendation is to create a mountpoint under each user's home directory considering it is specific to each user. Also be sure to have some housekeeping and have a logout script unmount the share as well.
J.I.
Posted on 06-12-2012 11:49 AM
Maybe if I throw in some code examples to show that it's possible to use a singular script across all users but make them dynamic. In python it is especially simple; I've written a number of applications that are dynamic like that.
Get the logged in user:
os.getlogin()
Get the username (and PID for that matter) of the user running the script (as in 'root' if user 'jamie' logs in, opens a terminal, sudo's a bash shell, then runs the application):
pwd.getpwuid(os.geteuid())[0]
Get the hostname of the machine and convert it to uppercase (this will change depending on your host/dhcp settings):
socket.gethostname().split(".")[0].upper()
So one could simply do, in python:
import os, subprocess
try:
subprocess.Popen("mount afp://{0}@server:/share /Users/{0}/ServerMount".format(os.getlogin()), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
except:
print("Failed to mount")
This is not verified code but a snippet showing the logical potential. Similar feats could be done in Bash of course as well.
J.I.