Sunday, July 24, 2005

Creating a reference (inetloc) to an network share (smb, afp) that works with keychain (OS X 10.3 - macOS 10.14)

I don't know where I read this, but I recently searched for this tip and had a bit of trouble finding it -- even though I had an example of what I wanted on my desktop! 

Most of our household files live for now an XP box (they may move to a G5 iMac). Mac clients often need to access this workgroup (non-Domain) share. I want the clients to mount the share seamlessly, without having to enter the share password. Unfortunately, creating an alias to the share, and saving the password and username to keychain, doesn't work reliably. Sometimes it works, sometimes it doesn't.

It's been a bug since 10.0 and it's never been consistently fixed. I can create an entry in the Ctrl-K list (smb://workgroupName;userName@serverName/shareName) and OS X will store the password, but that's not very user friendly. I need something similar that's clickable, aliasable, etc. The answer is to create an 'inetloc' that points to the share and includes a username. Keychain will correctly associate the password with an intetloc, perhaps because it's a physical file. You can create an alias to the inetloc and place it on the Finder left panel. 

 Intetloc creation is peculiar. They are created using the OS X "scrap" behavior. I use TextEdit for this purpose. Enter the inteloc string (same as Ctrl-K string) in text edit. Highlight it, click on the highlighted text, and drag it to to the desktop. On first use it will ask if you want keychain to store the password. As with the Go To Server method the text string is:

smb://domain;username@servername/sharename

or 

smb://domain;username:password@address/sharename

For example:
smb://mcgill;mgordon@boston/espressoLink
I wonder if the aliases work in Tiger ... 

 Update 7/24: Inetloc files have a rather dull default icon. I've never changed OS X icons, but it turns out that it's not too hard (see www.iconfactory.com for directions). The only catch is permissions -- you need to have write permissions for the file who's icon is being changed. Select source file, Cmd-I, select the icon at top, Cmd-C. Then select destination target file, select icon at top, Cmd-I then Cmd-V. What icon did I use? Since it was a family server the ideal would be to turn a picture of the kids into an icon. I might do that later, but I found a great free-for-personal-use server icon in the World of Aqua 5 Collection. I had some odd glitches with getting the reference in the left Finder bar to display this icon -- may have been permissions. Anyway it now displays and is quite a lovely way to show the server.
 
Update 8/2: I discovered that I can add this Inetloc file to my account's login item list. When I do that my network share loads on startup, and takes the password from my Keychain. I keep our family slideshow on the smb share, so I need this for my screensaver. Lovely!

(This article was updated 1/25/2021 because, well, it still works and I'm trying to fix a very annoying share problem in Mojave.)

1 comment:

  1. Thanks John -- works a treat... Great timesaver. Having to retype the password was starting to get rather tedious.

    ReplyDelete