The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   Networking (http://hintsforums.macworld.com/forumdisplay.php?f=14)
-   -   MAC OSX 10.5.2 Auto Map Network Drive (http://hintsforums.macworld.com/showthread.php?t=86652)

kayote 07-08-2008 10:59 AM

I've having much the same problem, but have dug a bit deeper.

Under 10.4 we ran a loginHook that would copy & modify an automator script (because some of the mounts included the username). The last line of the script was "open <modified for user automator script>". We did this because "open" worked for afp but not smb, despite claims in the documentation otherwise. It correctly used the user's AD credentials from login-- no extra passwords demanded, either for the login script or if they manually mounted another share after logging in.

Now? "open" doesn't work--at least the rest of the script works correctly, but the automator script doesn't run.

Manually mounting requires the AD username/pass to be re-entered for each server. Same thing if by hand the automator script is run.

Having each user login and mount by hand "the first time" is just not an option --it's a lab so we control the environment (dock) fairly stringently so it wouldn't carry over between logins, and there are just too many users to have them do anything manually one by one! (Same thing about setting login items--no way am I setting login items for hundreds of users. LoginHooks only).

kayote 07-10-2008 12:12 PM

I have a partial fix for this.

For mounting our Windows 2003 server shares

mount_smbfs -N //server/share /mountpoint

Does not demand a password. However, the mountpoints need to be pre-created directories. It also doesn't work for our one Linux share (which is odd, since that's the only one that's actually samba.)

My LoginHook is a shell script that:

mkdir mountpoint (for every share)

copy automator script that does nothing but run a shell script consisting of the mount_smbfs lines above--when adding a shell script to the loginitems (individual, rather than the universal loginhook) it wanted to open it in text edit rather than run it, so I stuffed it in an automator script.

copy a loginwindow.plist that points to said automator script into the user's preferences directory -- thus making it run as a LoginItem for that one user as soon as the LoginHook is done.

---

Clean & Elegant? No--but it works for mounting the Server 2003 shares w/o ore passwords.

dcrew 07-10-2008 12:37 PM

Was wondering if anyone found a solution for this? I actually had a very similar Apple Script solution set up to mount drives since back in the 10.3 days that of course now fails. Was using the same method:

Tell Finder
mount volume "smb://server/servershare"
end tell

Did you find a good solution?

hohenheimdelight 08-28-2008 03:02 PM

Mac OSX Login script
 
We recently bound all the macs on campus to a AD and heres the script I made to do this. We just had it run in the default users login items.

set MyName to do shell script "whoami"
tell application "Finder"
try
mount volume "smb://saga/" & MyName & "$"
do shell script "ln -s /Volumes/" & MyName & "$ ~/Desktop"
end try
try
mount volume "smb://saga/" & "common" & ""
do shell script "ln -s /Volumes/" & "common" & " ~/Desktop"
end try
end tell


This creates 2 mapped drives, one mapped to smb://saga/username$ and one to smb://saga/common and then creates an alias to them on the desktop (since 10.5 wont do that anymore).

iplayitofflegit 07-30-2010 04:43 PM

Tried this applescript, it simply won't work under 10.6.3
 
I attempted this script and get the following error w/ v10.6.4

CONNECTION FAILED

There was an error connecting to the server
"subdomain.domain.edu". Check the server name
or IP address and then try again.

If you are unable to resolve the problem
contact your system administrator.

If I enter the server name manually w/ Go -> Connect to Server in the Finder it works flawlessly. Authentication is not an issue, I have the proper kerberos certificates when logging in as a user.


This is the script I used based on the previous post:

set MyName to do shell script "whoami"

tell application "Finder"

try
mount volume "smb://subdomain.domain.edu/home/" & MyName & "$"
do shell script "ln -s /Volumes/" & MyName & "$ ~/Desktop"
end try

end tell


Can anyone help? What could be the issue? Why will OS X connect by Finder but not Actionscript?

Lien 08-09-2010 04:37 AM

http://forums.macosxhints.com/showthread.php?t=109766

I've been having issues with this for ages. We are going to get an application called Casper ( http://www.jamfsoftware.com/ ) which should help with this. Wasted way to much time with MAC's & AD.... Love to be able to kick Mr Jobs in the nuts for the amount of hours I have wasted on this... It keeps me in beer & cheap package holidays, so I'm not going to grumble :)

tlarkin 08-09-2010 09:02 AM

Quote:

Originally Posted by Lien (Post 592331)
http://forums.macosxhints.com/showthread.php?t=109766

I've been having issues with this for ages. We are going to get an application called Casper ( http://www.jamfsoftware.com/ ) which should help with this. Wasted way to much time with MAC's & AD.... Love to be able to kick Mr Jobs in the nuts for the amount of hours I have wasted on this... It keeps me in beer & cheap package holidays, so I'm not going to grumble :)

I have ran Casper for the past 3 years at my job. Awesome product, however, Jamf Software just uses the under-the-hood Unix and built in APIs from Apple. They aren't re-writing any code. They are using tools given to them, they just make it more efficient, and have more of an enterprise mindset. Where Apple, despite making enterprise products, still have a consumer mindset.

The AD Plug-in should now allow for SMB mounted home folders from an AD server.

As for using a log in hook and using the "whoami" command to find out what user you are, you cannot use that. Login hooks run as root user. So if you use "whoami" it will always return root.

There are several ways to determine who is logging in, my preferred way is to check ownership of /dev/console. Since once any user logs in, they acquire ownership of /dev/console. So, something like this:

Code:

CurrentUser=`ls -l /dev/console | awk '{ print $3 }'`

echo "$CurrentUser is currently logged in...."


I suggest you go grab a copy of setting up the "Golden Triangle," white paper over at www.afp548.com. It should have the steps needed to use AD for authentication and home folder. However, if you are also using OD, you can always host the home folders on an OS X server over AFP.

scottieb68 08-12-2010 12:33 PM

Drive mapping
 
Here's the AppleScript that has worked for me.

(*
: Login Scripting for the Apple Domain Users
:
: 09.29.04 Created 1.0
: 07.18.06 Changed1.5 Moved to new server locations
: 03.22.06 Changed 2.0 Removed User info from mounts (not needed).
:
*)

set whoami to "User ID goes here"
try
set volumeName to "Public"
if (list disks) does not contain volumeName then
mount volume "smb://" & whoami & "@file_share_path/" & volumeName
end if
end try

try
set volumeName to "Apps"
if (list disks) does not contain volumeName then
mount volume "smb://" & whoami & "@file_share_path/" & volumeName
end if
end try

try
set volumeName to "Departments"
if (list disks) does not contain volumeName then
mount volume "smb://" & whoami & "@file_share_path/" & volumeName
end if
end try

try
set volumeName to "Home"
if (list disks) does not contain volumeName then
mount volume "smb://" & whoami & "@file_share_path/home"
end if
end try


All times are GMT -5. The time now is 10:05 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.