Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Automount servers at login Network
I am not sure if this was ever posted before. But I just realized, that if you manually mount a server (cmd-K) and then drag the mounted server icon to your Login items window (in System Preferences), your system will automount them at startup. No password/login screen; it's just done.

[Editor's note: There have been other hints on automounting servers (1, 2), but neither discussed this simpler method. I don't have a network drive to easily test it with, so I can't vouch for its effectiveness.]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[18,328 views]  

Automount servers at login | 13 comments | Create New Account
Click here to return to the 'Automount servers at login' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
nope
Authored by: zedwards on Sep 11, '02 11:51:03AM

I tried this AND by adding the Favorite link to the login items and it does not work. "The operation could not be completed because no application was found to open the Internet location file '192.168.1.1"

If you drag the icon from the finder, you are just draging a link, so that would not work anyways because it becomes dead once you unmount it.



[ Reply to This | # ]
yup
Authored by: serversurfer on Sep 11, '02 08:33:55PM

Works for me

Are you trying it with an AppleShare (afp://)?

I mounted my buddy's drive, drug the drive icon to the LoginItems window, and logged out. When I logged back in, I got a keychain access dialog, which I told to "Always Allow". The drive then mounted, and opened a window focused on it. I logged out/in again, and the drive mounted quietly, and pretty quickly, too. :)



[ Reply to This | # ]
nope
Authored by: NewBlackDak on Sep 11, '02 10:40:58PM

This works great if you ouly have a single volume on a single server. This however has never worked for us with multiple volumes on multiple servers. I had to write scripts for each machine that doesn't only mount a single Volume(which is about 125). I wish fstab worked like it does in Linux!!



[ Reply to This | # ]
AppleScript will do it
Authored by: kworden on Sep 11, '02 10:42:41PM

You can do it with AppleScript. At least to an AFP Server running on WinNT 4.0(it's all i have to try it with)
In Script Editor, Create a new AppleScript and type the example below.
// Start AppleScript
try

mount volume "ShareName" on server "ServerName" as user name "Username" with password "Password"
mount volume "ShareName" on server "ServerName" as user name "Username" with password "Password"

on error error_message

beep
display dialog error_message buttons {"OK"} default button 1

end try
// End AppleScript
Save the File as Run-Only and then go to System Pref's, then Logon Items and Add the file you just created.
Now to test it Logoff and Log back on



[ Reply to This | # ]
yes applescript
Authored by: spoot on Sep 11, '02 10:54:58PM

here's an easy one

--

tell application "Finder"
activate
mount volume ("afp://user:password@ip/volume")
end tell

--

add the compiled script to your startup items. just make sure that the disc is not in your keychain... or you will be prompted to enter your keychain password before it'll mount. You can also just double-click the app to mount the server.

adios



[ Reply to This | # ]
yes applescript
Authored by: serversurfer on Sep 12, '02 04:45:42AM

Couldn't you just tell the keychain to Always Allow? Assuming that works, it would be better than having your log/pass stored in an AppleScript. Stuff in the Keychain is encrypted.



[ Reply to This | # ]
yes applescript
Authored by: kworden on Sep 12, '02 11:35:25PM

If you save the script out as an Application. No one can see the code!

:)



[ Reply to This | # ]
no one can see the code
Authored by: greed on May 16, '03 10:36:33AM

I invite you to run the UNIX command "strings" on your compiled AppleScript. I don't have any handy (I'm at work without any Macs), but I think you won't like what you see.



[ Reply to This | # ]
didn't need Applescript...
Authored by: muppetdog on Sep 12, '02 02:17:27PM

i just typed

afp://user:pass@nnn.nn.n.n/volumename

where nnn.nn.n.n is the IP address of the server (although i could have used the name) into my IE address field and dragged the link to my desktop.



[ Reply to This | # ]
didn't need Applescript...
Authored by: kworden on Sep 12, '02 11:41:34PM

Yeah but someone could access your password if you use IE to save it as a shortcut. All they would have to do is open it up and look at the URL. By using AppleScript it can save the Logon commands as an application where no one can get to the password.

:)



[ Reply to This | # ]
Another way...
Authored by: robg on Oct 09, '02 08:50:21AM
Here's a script from Anonymous, who writes:
Tried the other applescript suggestions for mounting smb shares at login, and couldn't get applescript to play nice until I used the following slightly different command:
tell application "finder"
mount volume "smb://username:password@serverip/sharename"
end tell
Save as application w/ never show startup option selected. Place the resulting app into the login items. All smb shares are now auto-mounted and placed on the desktop at login.
I haven't tried this one, but thought it might be worth adding to the collection. -rob.

[ Reply to This | # ]
Another way...
Authored by: david_bates on Oct 09, '02 10:57:12PM

Here is how I did it for SMB:

I connected to the share, checked the box to save the login info in the Keychain, and created an alias to the server. Then I compiled the following script as an App and added it to the Login Items list.

This way it uses the login/password from my keychain.

However, I know very little about AppleScript so there are probably much better ways to accomplish this.

tell application "Finder"
open alias file "<path-to-alias>"
close window "<window-name>"
end tell



[ Reply to This | # ]
Another way...
Authored by: Gonzonia on May 16, '03 08:48:51AM

That script seems to work well, except that the sharename can't have spaces.



[ Reply to This | # ]