I use a launch agent to connect users shared network drives at login. Things are going great with my new updates for the next school year, except that things get a bit odd when multiple users are signed in using Fast User Switching.
If user-A is logged in, and user-B logs in via Fast User Switching, user-A will have user-B's drives mounted as well. User-B's mount points will be appended with "-1" which means sidebar favorites added with mysides aren't pointing to the right location.
So, to try and be a bit more illustrative, this is what things look like when I run "mount" after this scenario:
//User-A@fileshare-01.school.net/staff$/User-A on /Volumes/User-A (smbfs, nodev, nosuid, mounted by User-A)
//User-A@fileshare-02.school.net/student_share on /Volumes/staff_share (smbfs, nodev, nosuid, mounted by User-A)
//User-A@fileshare-01.school.net/students$/User-B on /Volumes/User-B (smbfs, nodev, nosuid, mounted by User-A)
//User-A@fileshare-02.school.net/student_share on /Volumes/student_share (smbfs, nodev, nosuid, mounted by User-A)
//User-B@fileshare-01.school.net/students$/User-B on /Volumes/User-B-1 (smbfs, nodev, nosuid, mounted by User-B)
//User-B@fileshare-02.school.net/student_share on /Volumes/student_share-1 (smbfs, nodev, nosuid, mounted by User-B)
I could have my script check the mount point every time it runs and recreate the sidebar favorite with mysides, but I feel like better course of action would be to prevent other user's drives from mounting when Fast User Switching occurs. I've tried adding "su -l $user -c" before any of my commands and functions, but I get the same problem.
I'm using applescript inside of a bash script to mount any drives—something along these lines:
mount_script=`/usr/bin/osascript > /dev/null << EOT
tell application "Finder"
activate
mount volume "$protocol://${serverName}/${shareName}"
end tell
EOT`
Any ideas?