Leopard Mount Server without having to type in password

Back in Tiger and Panther before it I would mount servers in a Finder tell block like this:

mount volume “smb://scd2nts123.svr.hostname.net/MountVolume”

This would work as it basically passed on the name and password I had used to log into the computer. This was great as I could give this out to everyone and their login and password got used automatically and I didn;t have to hard code in a name and password and I didn;t have to come up with a way in the AppleScript to save their user name and password and make sure i did that in a secure way, etc.

So, in Leopard this doesn’t work any more. I always get prompted for my user name and password. Is there a way to pass along the user’s login name and password automatically like before?

Model: iMac Intel 10.5.5
Browser: Firefox 3.0.2
Operating System: Mac OS X (10.5)

I was wondering if shell scripts to mount the server would work better for this. I haven’t used shell scripts to mount server volumes before so I was wondering if anyone had examples. The Man page for diskutil, mount, and mount_afp are pretty cryptic for a first time user…

Hi,

Here is some sampe code to mount an afp server via shell.
SMB is not much different:


	-- Check if the mount is allready pressent.
	set MOUNTPOINTCHECK to do shell script "mount |grep " & mountpoint & " |awk '{print $3}'"
	if MOUNTPOINTCHECK = "/Volumes/" & mountpoint then
		-- It's allready there but we want to login our way so we give an error.
		tell progress indicator "connecting_progressbar" of window "connecting" to stop
		close panel window "connecting"
		tell window "connectingError"
			set contents of text field "text_field_title" to "Mount point allready exists."
			set contents of text view "text_view_error" of scroll view "scroll_view_error" to "It appears that this server is allready mounted via AFP.
Please unmount the server and try again."
		end tell
		display panel window "connectingError" attached to the front window
		error number -128
	end if
	
	-- Try to mount.
	try
		do shell script "mkdir -p /Volumes/" & mountpoint
		do shell script "mount_afp afp://" & user & ":" & pass & "@" & server & "/" & mountpoint & " /Volumes/" & mountpoint
	on error
		tell progress indicator "connecting_progressbar" of window "connecting" to stop
		close panel window "connecting"
		tell window "connectingError"
			set contents of text field "text_field_title" to "Unable to mount via AFP."
			set contents of text view "text_view_error" of scroll view "scroll_view_error" to "We're not able to mount your server through AFP.
Please make sure that the server in online, has AFP file sharing enabled and that the login information is correct."
		end tell
		display panel window "connectingError" attached to the front window
		error number -128
	end try

Please note that you have to fill certain veriables like user, pass, server and mountpoint.

Cool. Thanks. I’ll save that for future reference.

It sounds like I still the user’s name and password to run the shell script. Seems this is the case whether using shell scripts or plain applescript to mount.

So, I’m guessing from the dearth of responses that there is no way to tell an AppleScript or a Shell script to “mount this volume using the current user’s name and password”?? Does anyone have a way they work around this problem? Does everyone hard code their name and password into their scripts? That would cause a violation of security policy where I am. So far the only alternative I have is to leave it so the user has to manually enter their name and password when the script needs to mount the servers.

I’m curious if anyone has any alternative ideas.

Model: iMac Intel 10.5.5
Browser: Firefox 3.0.2
Operating System: Mac OS X (10.5)

I hear that the reason for my problem is a quirk (or bug) in Leopard with Kerberos. Kerberos should be saving the user’s name and password to pass along to any server mount (like it did in Tiger and Panther before that) but for some reason that is not working correctly.

I’ll post when/if I hear of a fix or workaround for this.