Connecting with different users to 1 server

With my Mac mini in a Windows LAN, I have the following problem:

  1. I can add my (cifs windows) network shares to my login script (Preferences -> Accounts -> Login), but when the mac wakes up from sleep, they are gone.
  2. When I want to connect to 2 shares on the same server, but one with a different account than the other, it doesn’t work. On login, the system chooses one of the accounts and uses it to connect to both network shares.

I think both problems are terrible, and particularly the way you connect to a network share in Finder using a password is confusing to say the least. Searching the web reveals hundreds of posts of people having the same problems. One wonders why apple didn’t solve this already.

I made a simple workaround for this problem by copy/pasting some script from several websites into the script editor (sorry guys, I’m lazy). I then saved it both as application and as source. I use the script to mount the drives at logon, and re-mount them when the Mac wakes from sleep mode. Until I come up with a better idea, or somebody can point to a nicer “Apple way” solution, or Apple fixes this dreadful problem in OS X, here is my script:

tell application "Finder"
	open location "cifs://WORKGROUP;iTunes@KAGE/iTunes"
	open location "cifs://WORKGROUP;Guest@KAGE/incomming"
end tell

When running a script like this for the first time, the system asks you the passwords. Type them in and save them in your keyring. The next time they won’t be asked, and you have no readable passwords in your script. Nice. The downside of this script is that it opens a ton of finder windows. I have nosed around in Automator but can not find a way to close them automatically. I also tried to record a script, but that gave me an even more “unusable” script.

I hope this helps you too. If you think this can be done in a nicer way (without too much scripting) please let me know.

Update: Seems I was to quick about the keyring app. I did need to add passwords to the script (add “:password” after the userid without the quotes). Stupid machine does not understand what I want.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s