When you have to copy files from one Mac to another, make big files available to others, or get files from your companys shared volumes, you need to connect to a server. It may be a file server, a NAS (network-attached server), or just another Mac on your network. You probably already know a basic way to perform this everyday task, but is that method the quickest and most convenient? Here are eight ways you can connect to a server.
1. Connect from the Finder
One of the simplest ways to connect to a server is to click its name in the Shared section of a Finder window sidebar. (If you dont see the Shared section, choose Finder > Preferences, and then check Connected Servers under Shared.) If youre connecting to the server for the first time, youll see a dialog box asking for your user name and password.
You can streamline the process by checking Remember This Password in My Keychain. The next time you click the server in the Finder window sidebar, youll connect automatically.
When you connect to a file serversuch as another Macin this manner, the Finder window will show you all available shares. The shares include your home folder, if youve logged in with a user name and password for that Mac (if, for example, youre connecting remotely to your laptop computer); public folders for other users of that Mac; and any disks or volumes that you have access to.
2. Connect using an alias
If you visit a particular folder on a server frequently, you can connect more quickly by adding an alias of that folder to your Mac. An alias is a kind of shortcut, and you can spot it easily by the little arrow at the bottom left of its icon. After you've connected using the method above, hold down the Command and Option keys, and drag the folder to create an alias on your Mac. Put it on your desktop or anywhere else; you can even put it in the Favorites section of your Finder sidebar, or in the Dock.
To connect and go to that specific folder, double-click the alias, or single-click if its in the Finder sidebar or in the Dock. This method will save you a lot of time if the folder you need to access is buried in the servers hierarchy.
Bonus shortcut: Select a folder and press Command-T to add it to the Finder sidebar, in the Favorites section, without going through the steps of creating an alias.
3. Connect via the 'Connect to Server' dialog box
Press Command-K while in the Finder (or choose Go > Connect to Server) to reveal the 'Connect to Server' dialog box. Here you can connect to a wide variety of servers, not just to those that show up in the Finder sidebar. (Only Mac and Windows servers, using either AFP or SMB for sharing, will appear in the sidebar by default.) For example, you can use this method to connect to an FTP server when you need to upload some graphics that you want to use on your blog. In the Server Address field, enter the servers name, such as ftp://ftp.example.com. If you connect to a server often, click the plus-sign (+) button, and the server's URL will be saved in the Favorite Servers section of the dialog box.
To connect to another Mac on your local network, either click Browse and find the network, or (if you know its name), enter its name as .local (for example, pequod.local, as in the screenshot above.
4. Connect from the Apple menu
Want a quick way to reconnect to a server? Click the Apple menu, and then choose Recent Items. Youll see a list of the most recently visited servers at the bottom. Select the one you want, and it will mount in the Finder.
5. Connect from Safari
Suppose that you need to get a file from the laptop you left upstairs. Type protocol://user:password@server_name/share into your Web browsers address bar; the browser will pass the request on to the Finder, which will connect to the server. For example, to connect a user to his home folder on my laptop, named pequod, I would enter afp://ahab:[email protected]/ahab.
The afp stands for "Apple File Protocol," which is what Macs use for standard file sharing. This method includes your password, so use it with caution.
Think it doesn't sound practical? Actually, it can be, because you can save a bookmark to a server, even to a local Apple File Protocol server. If youve already connected to the server and the password is in your keychain, you need only type afp://server_name.local. Press Command-D to save a bookmark.
Safari will save the bookmark with an http: prefix. To make it work, you must choose Bookmarks > Show All Bookmarks, find the bookmark in question, right-click, and choose Edit Address. Replace 'http' with the correct prefixfor example afpand youll be able to use the bookmark to open a server in the Finder from your Bookmarks menu or Bookmarks bar.
6. Connect with a webloc bookmark
You can also create a bookmark that functions just like an alias. Type the necessary text to connect to your server, such as afp://pequod.local/kirk in a new document in a text editor. Select that text, and drag it to the Finder. A file will appear with an @ icon. Double-click this to connect to the server. You can stick this file in the Dock if you wish, in the section to the right of, or below, the line.
7. Connect in an Automator workflow
If you want to connect to a server as part of an Automator workflow, you can do so by adding two items to your workflow. Launch Apples automation utility (in /Applications) and look under the Files & Folders heading. The first action, 'Ask for Servers', lets you choose what types of servers (if any) to display, and whether the user can enter a URL. The second action, 'Connect to Servers', establishes the actual connection after a user selects a server.
8. Connect using an AppleScript
For the most part, visiting a server is a simple task that doesnt require programming or scripts. However, there may be times when you'll want to connect to a server using an AppleScript. To do this, use the following syntax:
tell app "Finder" to open location "protocol://username:password@server/share"
For example, to have a user connect to my home folder on my laptop, named pequod, Id use the following:
tell app "Finder" to open location "afp://ahab:[email protected]/ahab"
If youve already connected to the server in question, and your password is in your keychain, you can eliminate that part of the command:
tell app "Finder" to open location "afp://pequod.local/ahab"
If you omit the user-name-and-password part of the command, and the password is not in your keychain, the Finder will display a dialog box asking for that information.
If you want to see some even geekier ways to connect to servers, check out this article on the Mac OS X Hints website.