Working with Remote Servers and Networks

Một phần của tài liệu Mac OS x leopard (Trang 391 - 409)

Figure 21-1.Browsing the local network in the Finder

The upshot is Leopard’s screen-sharing feature can connect to machines that are not running Leopard. Both Tiger (10.4) and Panther (10.3) come with the necessary client software already installed.

When you make a screen-sharing connection, you will be prompted for a username and password. Upon authentication, the system will launch an application named Screen Sharing. Its main window will contain a live, interactive image of the remote computer’s desktop. Depending on the remote computer’s settings, you can take control of the cursor, launch and use applica- tions, and manipulate files.

The Screen Sharing application has a few preferences worth checking out. By default, the remote screen is scaled to fit your screen, data is minimally encrypted to improve network per- formance, and drawing quality is adjusted on the fly depending on the quality of your connection. You can instead elect to view the screen at full size, to encrypt all data, or to draw the screen at full quality regardless of performance.

NOTE This section deals only with connecting as a client to machines that already have a net- work service available. We’ll discuss how to enable your machine as a server in the “Sharing”

section later in this chapter.

Connecting Directly

The Finder’s network browsing is limited to machines on your local network, but the Finder can address any machine, local or remote. As long as you can resolve an IP address or a domain name to it, you can connect to it directly using the Finder’s Connect to Server window, as shown in Figure 21-2.

Launch the Connect to Server window from the Finder’s menu bar by selecting Connect to Server from the Go menu, or press Cmd+K. To connect to a machine, type its address in URL form into the Server Address text field. If you intend to connect to the machine on a regular basis, click the + button to add it to the Favorite Servers list.

In the previous section, we connected to a machine using the Connect As button in the Finder. We could have also established that connection directly by typing the machine’s URL, like so:

afp://10.0.1.5

Figure 21-2.Connecting to a server by name in the Finder

Connecting to a machine in the Finder will use the default protocol. Connecting directly allows you to explicitly specify the protocol. Valid protocol declarations include the following:

afp: The Apple Filing Protocol is the standard protocol used for addressing remote volumes in the Finder. Although it is Apple’s standard, AFP support is available for many operating systems, including Windows, NetWare, and several flavors of UNIX and Linux. If you do not specify a protocol, afpis assumed.

at: AppleTalk is an obsolete networking protocol that is included for backward compatibility. Previous versions of AFP used AppleTalk behind the scenes, but modern AFP uses the Virtual Network Computing standard on top of standard TCP/IP.

nfs: The Network File System protocol is a remote file access protocol developed by Sun Microsystems. It is similar to AFP and is available for several flavors of UNIX, as well as for operating systems such as NetWare, Windows, and, of course, Mac OS X.

smb: The Server Message Block protocol is the Windows equivalent to AFP. From within Windows, it’s referred to simply as Microsoft Windows Network. The SMB protocol is sometimes called Samba, though technically Samba is a free reimplementation of SMB and not simply another name for the same thing.

cifs: The Common Internet File System, despite its name, is actually just a rebranding of SMB to reflect changes Microsoft made to the protocol since its invention at IBM. It was submitted, but not accepted, as an Internet standard. It can be considered to be the same as SMB.

http: The Hypertext Transfer Protocol is the standard protocol of the World Wide Web.

Taking advantage of the ubiquity of the Web, HTTP is used for transporting more than web pages. For example, the WebDAV standard is used to mount remote file systems over HTTP. This is the same standard used when connecting to iDisk, which we’ll discuss in the

“Connecting to .Mac” section of this chapter.

https: The secure version of HTTP is not a true protocol. Instead, it simply refers to the use of standard HTTP over a connection that has been encrypted by either the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocol.

ftp: The File Transfer Protocol is a very old standard for moving files from one computer to another. Because of its age and that it’s compatible with every known operating system, it’s in widespread use all over the Internet.

ftps: Analogous to HTTPS, FTPS refers to the use of regular FTP over an SSL or TLS connection.

CHAPTER 21WORKING WITH REMOTE SERVERS AND NETWORKS 367

Conspicuously absent as available protocol declarations in the Connect to Server window are sftp, the Secure Shell File Transfer Protocol; svn, the Subversion file transfer protocol (although Subversion can be transacted over other protocols, such as HTTP); and file, as used in standard file URLs. The absence of file URLs is notable not because they have much meaning in a dialog intended for connecting to servers but because they are used extensively throughout the system. Using them in the Connect to Server window simply returns an error.

Connecting in Darwin

Although using a computer’s graphical interface via screen sharing is relatively new, the concept of using one computer to log in to and control another computer remotely is anything but. UNIX is, by its very nature, a remotely controllable operating system, and old-fashioned shell-to-shell networking is very much alive in Terminal, as shown in Figure 21-3.

Figure 21-3.Remote computing by Secure Shell in Terminal

To connect to another machine, open Terminal from /Applications/Utilities. From the command line, invoke sshwith the username and address of the machine you want to connect to, separated by the “at” sign. For example, to connect to a machine at the local IP address 10.0.1.5 with the username booksystem, you would type this:

ssh booksystem@10.0.1.5

NOTE You don’t have to use a local IP address or an IP address at all. Anything that can be resolved on the Internet is valid, including standard and local domain names.

If you are connecting to a machine for the first time, you will be asked whether it is safe to proceed. Confirm this by typing yes. Unlike most UNIX programs, you have to type the entire word. You will then be prompted for a password and then, assuming you can authenticate prop- erly, presented with a welcome message and the command prompt.

From this prompt you can create, delete, and alter files and folders, as well as list, run, and kill processes. You can even launch new shells and Secure Shell into other servers. It’s the same as if you were sitting at the remote machine typing into a Terminal window.

This can have unexpected consequences. For example, any DNS resolution will be in terms of the remote machine. If you have domains listed as default, local hosts, or discrepancies in the closest name server’s routing table, the remote machine might behave differently than would your local host.

To log out of the remote server, type exit. This is the same as exiting any shell, so bear in mind that if you’ve launched a new shell from within the Secure Shell, typing exitwill not log you out. Fortunately, when you log out of a Secure Shell session, Secure Shell will let you know the connection is closed. If you don’t get that confirmation, assume you are still logged in.

Remote login via Secure Shell can be enabled from System Preferences, as discussed in the

“Sharing” section later in this chapter.

NOTE Secure Shell replaces the older Telnet application. Both programs accomplish the same thing, but sshuses encryption to ensure an attacker cannot view your data in transit. Most machines do not allow insecure access, but Telnet remains in the UNIX toolbox for backward compatibility.

Darwin also includes an ftp program for using the File Transfer Protocol to move files between machines. As opposed to shell access, which allows for all manner of shenanigans, FTP access is much more limited, restricting user privileges to basic file operations.

To use FTP from the command line, simply type ftp. Unlike Secure Shell, FTP can be invoked without actually opening a connection. To connect to a remote machine, type open, and then, when prompted, enter the address of the machine, your username, and your password.

Unlike the Finder’s Connect to Server menu, Darwin does not have an ftpscommand, but it does have an sftpcommand, which works just like the regular ftpcommand. However, although opening a connection and supplying your username at invocation time are optional in ftp, they are required in sftp.

sftp booksystem@10.0.1.5

Enter your password when prompted, and then proceed as normal.

Whatever the advantage to using sftp, moving files back and forth in the terminal is almost too complicated to make it worthwhile, but if you really want to know, type man ftpor man sftp in the terminal to read all about it. A much better idea would be to use a dedicated FTP client.

Third-Party Solutions

The Finder was designed to be a file browser, so it’s a great way to take advantage of remote file protocols, such as AFP, SMB, and WebDAV. However, just as you wouldn’t use the Finder to surf the Web, it’s also ill-suited for dealing with the peculiar needs of FTP and related protocols.

Instead, it’s best to turn to third-party solutions.

Transmit

I’ve used a lot of FTP clients on a lot of different platforms, but one application stands head-and- shoulders above any other: Transmit (www.panic.com/transmit/). This award-winning application is available only on the Mac and was written by Panic, a Portland-based, Mac-only software company held in the highest esteem by developers and users alike.

As shown in Figure 21-4, Transmit has a simple, native drag-and-drop interface that belies its power. Under the hood Transmit has a robust file transfer engine that works with all manner of protocols, including FTP, FTPS, SFTP, WebDAV over HTTP and HTTPS, and Amazon S3. It also deals with such vagaries as proxies and passive mode.

CHAPTER 21WORKING WITH REMOTE SERVERS AND NETWORKS 369

Figure 21-4.Connecting to an FTP server with Transmit

Other features in Transmit include directory synchronization, bookmarks, and remote view- ing and editing. What really makes it worth the price is the level of integration it has with Mac OS X, including the Dock, iDisk, Bonjour, Dashboard, AppleScript, and Automator. It also works with .Mac’s syncing feature so your bookmarks are always backed up and in sync.

Transmit is available for $29.95. You can download it from Panic’s web site and try it free for 15 days, after which time certain features are limited.

NOTE Several free and open source FTP clients are also available for the Mac, such as NcFTP (www.ncftp.com) and CyberDuck (http://cyberduck.ch/).

BBEdit

One of the most common uses of FTP and other file transfer protocols is for uploading content to a web server. Some applications have file transfer capabilities built in to streamline your work- flow.

Bare Bones’ BBEdit (http://barebones.com/products/bbedit/) is probably one of the oldest and most respected text editor on the Mac. It has the kind of understated interface over tremen- dous power beloved by veteran users of the great UNIX text editors Emacs and Vi. But it also has the convenience and easy approachability of a graphical application, as shown in Figure 21-5.

BBEdit’s features are too numerous to enumerate, but suffice it to say it’s not only a great text editor but also a great web page editor. Germane to the subject at hand, BBEdit can open and save files to a remote server via FTP or SFTP, eliminating the need for a separate file transfer protocol.

BBEdit is $125 but has a demo mode and significant discounts for students and users of pre- vious versions. Bare Bones also makes a free “lite” version called TextWrangler. Although it lacks the most advanced features of BBEdit, TextWrangler has BBEdit’s best features, including the FTP functionality.

Figure 21-5.Saving a file directly to a server in BBEdit

Connecting to .Mac

As Transmit and BBEdit demonstrate, integration is the order of the day for many native Mac applications. As the Finder’s built-in networking demonstrates, this is also true of the system in general. However, when it comes to simplicity through integration, nothing compares to Apple’s .Mac.

NOTE If you’re not familiar with .Mac, check out Chapter 15.

Connecting to .Mac is easier than connecting to other Internet hosts. You don’t have to access it with Terminal or Transmit, because the interface is built into Mac OS X. You also don’t have to deal with online control panels or configuration files because all that is handled from within System Preferences, as shown in Figure 21-6.

iDisk

If you create a web site in iWeb, which is part of iLife and included free on every new Mac, you can publish your home page to .Mac with one click. If you use another program to create your web pages, you can just mount your .Mac server space, known as iDisk, and copy, move, or delete files in the Finder.

If you have a bunch of pictures in iPhoto and you want to share them with your family, you can publish them straight to .Mac. You can also use .Mac to share movies you make in iMovie or music and podcasts you make in GarageBand. Using .Mac is all about putting things on the Web without ever having to actually deal with the Web.

CHAPTER 21WORKING WITH REMOTE SERVERS AND NETWORKS 371

Figure 21-6.Setting up .Mac in System Preferences

Much like your home account, your .Mac account contains a public folder. If you want to put something online for a friend or co-worker, you just copy it to your public folder. If you have a friend who puts something in their public folder for you, you can mount their public folder in the Finder as well.

To access your iDisk, click its icon in the Devices section of any Finder window. The Finder’s menu bar also contains an iDisk submenu under the Go menu. You can use that to connect to your iDisk, another user’s iDisk, or another user’s public folder. You can also jump to your iDisk by pressing Shift+Cmd+I.

If your friends don’t have a Mac, let alone .Mac, that’s OK. With a few clicks, you can set up a file exchange site so people can download and upload files to your public disk from their web browser, as shown in Figure 21-7. If you’d rather not have your public disk be entirely pub- lic, you can password protect it.

Back to My Mac

In Leopard, Apple introduced a new feature called Back to My Mac. When you turn Back to My Mac on, the .Mac server keeps track of where on the Internet your computer is. Should you find yourself at work or school having left your big presentation sitting on your desktop, no worries.

With Back to My Mac, you can log into your machine remotely and access the missing files.

To use Back to My Mac, select the .Mac pane in System Preferences, and then choose the Back to My Mac tab. Click the Start button to make your computer accessible from the Internet.

Then, click the Open Sharing Preferences button to move to the Sharing pane. From here, enable screen sharing, file sharing, and other services you’d like to be able to access remotely.

Figure 21-7.Navigating an iDisk in the Finder and Safari

NOTE For more information on the various sharing services, see the “Sharing” section later in this chapter.

Third-Party Integration

A platform is only as strong as its third-party development. Even though Apple writes a lot of great software and bundles most of it for free with every new Mac, what really makes the plat- form amazing is how much great third-party software there is. Development on the platform is strong, competitive, and innovative.

It’s the same story with .Mac. Apple doesn’t hog it all to itself. Rather, Apple has opened it up for development and encouraged developers to incorporate .Mac into their applications.

Many developers do, and why not? Customers love being able to use .Mac, and providing a great user experience is what makes great software.

Third-party software can (and does) take advantage of .Mac to back up and sync the data on all your machines. For example, Panic’s Transmit uses .Mac to sync bookmarked FTP servers, and Bare Bones’ Yojimbo uses .Mac to sync bookmarks, notes, and other stored data. Third- party developers also take advantage of .Mac’s ability to get your stuff on the Web with little to no effort on your part.

I’ll give you a personal example. My company makes a piece of software for organizing your personal media collection called Delicious Library. In Delicious Library 2, we added a fea- ture called Web Publishing. This is probably the number-one requested feature, and it’s definitely the biggest selling point of the new version. When we won the Apple Design Award for Best Leopard Application, this was the feature the judges showed off.

When you publish a collection, you can send it to iWeb to deal with it as you will. If you have a server, you can set up an FTP account and upload it that way. You can also publish your collection to a folder and use Transmit to deal with it. In any case, it’s pretty easy, but it takes a few steps and some configuration—that is, unless you have .Mac, as shown in Figure 21-8, in which case, you don’t have to configure anything because all your .Mac account information is

CHAPTER 21WORKING WITH REMOTE SERVERS AND NETWORKS 373

already known to the system. You can just hit the Publish button, and your collection will be turned into a web page and uploaded to your .Mac account. When it’s done, you can visit your collection online and send the link to your friends to check it out.

Figure 21-8.Publishing to .Mac in Delicious Library 2

If your friends are using Delicious Library as well, your collection will automatically be added to their computers so they can browse your media from within Delicious Library. You don’t have to take any additional steps. All of that stuff is handled automatically by .Mac.

Informal Networking

It wasn’t that long ago when there was no Internet to which regular people could connect. Back then, setting up a local area network in your house was far too expensive to be feasible, and wireless networking wasn’t even something most people could fathom. Yet, whenever two peo- ple had a file they wanted to exchange that wouldn’t fit on a 1.44 MB floppy disk or they wanted to play some head-to-head Doom, they were always faced with the same problem: how the heck do we connect these two computers?

Even when the Internet was well established and routers were cheap, creating a small, infor- mal network between two or three computers was always a big challenge. Fortunately, the modern Macintosh makes these arrangements, known as ad hoc networks, extremely easy to set up and use.

Target Disk Mode

The first question you have to ask yourself is, why do I want to connect two computers? A lot of times, as then, it’s to exchange files. Whether it’s to copy some work from a laptop to a desktop

Một phần của tài liệu Mac OS x leopard (Trang 391 - 409)

Tải bản đầy đủ (PDF)

(626 trang)