Chapter 34. Sharing Files and Running Network Services

The Macintosh has always made it simple to share files with other Macs on the same network and over the Internet. Mac OS X’s strong Unix roots bring even more sharing capabilities to the Mac, including the capability to connect to Windows systems. In this chapter, you learn how to activate various sharing features.

Sharing Services

A service is something that your computer provides to other computers on a network, such as running a Web server or sharing files. In Mac OS X, you can enable or disable all the standard information-sharing services from the Services section of the Sharing pane in System Preferences, as shown in Figure 34.1.

The Services options of Sharing Preferences enable you to choose which sharing services you want running on your computer.

Figure 34.1. The Services options of Sharing Preferences enable you to choose which sharing services you want running on your computer.

Watch Out!

Be aware that turning on or off any service in the Sharing pane activates that service for all user accounts on a computer. If sharing is on for one user, it’s on for everyone. If it’s off, it’s off for everyone!

You can enable or disable the following services:

  • Personal File Sharing—Share your files with other Mac users across a local network. We’ll discuss activating AppleTalk, if needed, in just a moment.

  • Windows Sharing—Share your files with Windows users on your local network.

  • Personal Web Sharing—Serve Web pages from your own computer using Mac OS X’s built-in Web server.

  • Remote Login—Allow users to interact with your computer remotely using Secure Shell (SSH) command-line access.

  • FTP Access—Allow access to your machine via FTP, (File Transfer Protocol).

  • Apple Remote Desktop—Allow individuals using Apple’s full version of Remote Desktop to access your computer.

    By the Way

    Essentially, Apple Remote Desktop allows someone to look over your shoulder (or even take the controls if needed) as you work, without being in the same room. To make this work, the remote viewer does need to purchase and install a copy of Apple’s Remote Desktop, but this is a great option for people in learning labs or help-desk situations!

  • Remote Apple Events—Allow software running on other machines to send events to applications on your computer using the AppleScript scripting language. We don’t delve into this option, but AppleScript is discussed in Chapter 39, “Introducing AppleScript.”

  • Printer Sharing—Grant other computers access to the printers connected to your computer. With this service enabled, your printers appear in the Printer Setup Utility’s printer list for other users on your local network. General information about connecting to printers is covered in Chapter 20, “Printing, Faxing, and Working with Fonts.”

    By the Way

    The Firewall section of the Sharing control pane contains a list of the same options as the Services section, with the exception of Apple Remote Desktop. A firewall sits between the outside network and network services on your computer to protect your computer from network-based attacks. The Firewall options enable you to activate Mac OS X’s built-in firewall software to prevent access to your computer through those services you don’t want to run. We’ll discuss this further in Chapter 35, “Sharing Files to Windows and Unix Computers.”

Now, let’s take at look at starting and using these services.

Activating Personal File Sharing and AppleTalk

Personal File Sharing is Apple’s method of sharing files with other Mac users over a network, either via TCP/IP or AppleTalk. AppleTalk is a legacy protocol for browsing and accessing remote workstations that share files or services, such as printers. Apple is transitioning to use of the TCP/IP-based Service Locator Protocol (SLP) and a local network-based services feature called Rendezvous, mentioned in Chapter 16, “Using iChat AV.” However, you might still need to enable AppleTalk to access older devices or Macs running pre-OS X operating systems.

Follow these steps to share your files with another Mac user:

  1. Determine whether you need to use AppleTalk to access computers and printers on your network. If all the other computers are Mac OS X machines and your printer is USB-based, you probably don’t need AppleTalk support—skip ahead to step 8. If you’re not sure, go to step 2.

  2. Open the Network Preferences pane, found in the Internet & Network section of System Preferences.

  3. Use the Show pop-up menu to choose the device you’re using to access your network (such as AirPort or Ethernet).

  4. Click the AppleTalk button to reveal the options shown in Figure 34.2.

    Make sure that AppleTalk is active before trying to share files on a network containing users of both OS X and older Mac OSes.

    Figure 34.2. Make sure that AppleTalk is active before trying to share files on a network containing users of both OS X and older Mac OSes.

  5. Check the Make AppleTalk Active check box. (To make the change, you might first have to click the small lock button at the bottom of the window and type an administrator’s username and password.)

    By the Way

    If you don’t recall the difference between administrative and nonadministrative users, you may want to review Chapter 33, “Sharing and Securing Your Computer and Files.” For now, all you need to know is that the first-created user account is an administrative account. Other accounts may or may not be administrative, depending how they were set up.

  6. If necessary, choose an AppleTalk Zone to use. You might want to speak to your network administrator if you aren’t sure what to choose.

  7. Click Apply Now.

  8. Open the Sharing Preferences pane, as shown previously in Figure 34.1, and check the box for Personal File Sharing, or highlight it and click the Start button.

  9. Close the System Preferences window.

Your Mac OS X computer should now be able to share files with other Macs on your network. We’ll talk about how to actually connect to other users’ files later in this chapter in the section “Connecting to Shared Folders.”

Activating Windows Sharing (Samba)

Windows computers use a different protocol than the Mac for file and print sharing. To share files with Windows computers, your Mac must employ the same protocol through a piece of software called Samba.

To turn on Windows Sharing (Samba), open the Sharing System Preferences pane to the Services section and then either click the check box in front of the Windows Sharing line, or highlight the line and click the Start button. The Sharing pane updates and shows the path that can be used to map (mount) the drive of your Mac on a Windows-based computer, as demonstrated in Figure 34.3.

Activate Samba for file sharing with Windows computers by using the Sharing preference pane.

Figure 34.3. Activate Samba for file sharing with Windows computers by using the Sharing preference pane.

Like AppleShare file sharing in Mac OS X, the built-in Samba configuration is limited to sharing each user’s home directory. By default, user accounts are enabled for login from Windows. The home directory of the user can be accessed through the path that appears in the Sharing preferences pane in the Services section when Windows Sharing is highlighted, as in Figure 34.3. (We’ll talk about accessing files from a computer running Windows in the section “Connecting from a Windows Machine.”)

Activating Web Sharing

Mac OS X makes it easy to run a simple Web server using a popular, and powerful, open source server called Apache. (Apache is actually the server that powers most Internet Web sites. It’s built to run complex sites, including e-commerce and other interactive applications, and it’s running on your desktop as a part of Mac OS X.)

Mac OS X can share a personal Web site for each user on the computer. In addition, it can run a master Web site for the whole computer entirely independent of the personal Web sites.

To turn on Web sharing, open the Sharing System Preferences pane (shown in Figures 34.4) and check the box for Personal Web Sharing, or highlight it and click the Start button. The Apache server starts running, making your Web site immediately available. Make a note of your personal Web site URL as shown at the bottom of the window and then start Safari to verify that your personal site is online.

Turn on Web Sharing and note the address of your Web site.

Figure 34.4. Turn on Web Sharing and note the address of your Web site.

With Safari running, enter your personal Web site URL, which should be the following format:

http://<server ip or hostname>/~<username>

The tilde (~) is extremely critical. It tells the server that it should load the Web pages from the Sites folder located inside the user’s home directory. Note that after you activate Web sharing for one user, it’s active for all users, so make sure that all users are ready to have their Web sites shared with the rest of the world.

Assuming that you entered your URL correctly, you should see the default Mac OS X home page, as demonstrated in Figure 34.5.

Apple includes a default personal home page.

Figure 34.5. Apple includes a default personal home page.

To edit your Web site, just look inside your Sites folder. The default page is generated from the file index.html and the Images folder.

Watch Out!

Under Mac OS X’s user interface, it isn’t possible to change the filename of your home page. When you start creating files, make sure that the first page you want to be loaded is named index.html; otherwise, your site might not behave as you want.

To edit an HTML document, you can open it in a text editor, such as the TextEdit application discussed in Chapter 6, “Using Calculator, Stickies, Preview, and TextEdit.” (Note that you will need to adjust the preferences to ignore rich text commands in HTML files, or you will see a Web page rather than an editable HTML page.)

By the Way

If you are interested in making your own simple Web pages, I highly recommend reading Teach Yourself HTML and XHTML in 24 Hours to learn the basics.

You may have noticed that two Web site addresses are shown at the bottom of the screen when Web Sharing is activated: there’s one for your own account and one without the ~<username> portion. The one that doesn’t specify an account is the Web site for the computer rather than a specific user. If you haven’t already done so, enter that address in a browser now. If no one with access to your system has created a new page for your computer, you should see something similar to the page shown in Figure 34.6.

The default page for your system looks different than your default personal page (shown in Figure 34.5).

Figure 34.6. The default page for your system looks different than your default personal page (shown in Figure 34.5).

This is the system Web site, and it can be used for anything you want, but you must do a bit of digging to reach the directory that holds it.

The system-level site is in the Documents folder located in a folder labeled Webserver inside the Library folder of the hard drive. (Note, there are several folders labeled Library at various levels in OS X—this one is at the same level as the Applications and System folders.) Any administrator can make changes to this directory, so make sure that the other admin users on the system understand its purpose and that they don’t assume that it’s related to their personal Web sites.

Viewing Web Site Statistics

For every visit made to a Web site located on your computer, the Apache Web server makes an entry in its log files. These log files can tell you who looked at your files, what they looked at, and the IP address of their computers. Keeping track of this kind of information helps you understand who the audience for your Web site is and what types of information they’re seeking. (If your site has more than one page, seeing what pages people visit can show you what people like (or what they can find) and what may need more work!)

The logs for your server are located in the /var/log/httpd directory and are named access_log and error_log by default. You can open these files in a text editor, view them from the command line, or monitor them using the Console application by following these steps:

  1. Open the Console application located inside the Utilities folder of the Applications folder.

  2. From the File menu, select Open Quickly, select /var/log, select httpd, and, finally, select access_log.

  3. A window such as the one displayed in Figure 34.7 opens with the contents of the Apache access_log file.

    The Console application can be used to monitor your logs.

    Figure 34.7. The Console application can be used to monitor your logs.

As you and other users access the Web sites on your computer, you can view information about each of the hits within the log window. Each row displayed is a record of what computer has visited your site, what was viewed, and when it was viewed. Take for example the following log entry:

10.0.1.116 - - [10/Aug/2003:19:13:38 -0400] "Get /~robyn http/1.1" 301 336

Essentially, this means that the computer with the IP address 10.0.1.116 visited on the 10th of August, 2003, at 7:13 PM to view the default page for the user “robyn.” The extra numbers at the end of the entry are a code reporting how the Web server responded to the request and the size of the file (in bytes) served to the viewer’s computer for the given item.

By the Way

Hits represent each of the page elements that are served to create a Web page. The list of hits in Figure 34.7 is from viewing the page shown in Figure 34.6 and the system-level default Web page once each. (There are so many rows of information because the Web pages and each separate image count as a hit.)

Although accurate, this information can be difficult to interpret—especially if many visitors have viewed your Web site. You can install a number of applications (both free and commercial) to help translate the raw Web logs into something a bit more meaningful. To help you get started, take a look at the following products and Web sites:

  • Analog—www.summary.net/soft/analog.html

    Analogy is a robust, fast, free program for analyzing Web statistics. Reports include basic bar graphs and pie charts.

  • Summary—www.summary.net/summary.html

    Summary produces Web statistic summaries of just about anything that can be determined from Web page requests, including search terms that lead to a page and various types of errors that occurred on a site. It is available for a free 30-day trial.

  • Traffic Report—www.seacloak.com/

    Traffic is another Web statistics analyzer that presents a wide variety of reports. It is available in a lite and full version, with pricing to reflect the levels of functionality. A 30-day free trial is available.

  • Sawmill—www.sawmill.net/

    Sawmill produces attractive, easy-to-read Web statistics reports with graphs and color-coding. It is available for a free 30-day trial.

Activating Remote Login and FTP

Two additional methods of file sharing available in Mac OS X are FTP and SSH. FTP (File Transfer Protocol) simply provides cross-platform file-transfer services. The second type of sharing, SSH (secure shell), enables a remote user to access the command prompt of a Mac OS X computer from anywhere in the world.

Both of these protocols can be turned on in the Services section of the Sharing preferences pane. SSH is turned on through the Remote Login check box you saw previously in Figure 34.4. Activate FTP by clicking the Allow FTP Access check box. Alternatively, you can highlight the option you want to activate and click the Start button.

Now that you know how to turn these services on, let’s see what they can do for you!

Remote Login (SSH)

SSH, or as Apple calls it in the Sharing pane: Remote Login, is a new concept for most Mac users. If you’ve seen a Windows or a Linux computer before, you’ve probably occasionally seen someone open a command prompt and start typing text commands instead of working with an icon-filled desktop. Although SSH isn’t the command line itself, it provides a secure means of accessing the command line from a remote location. In an SSH connection, the entire session is encrypted. As such, administrators can log in to their systems using SSH and edit user accounts, change passwords, and so on, without the fear of giving away potentially damaging information to those who are watching network traffic for information to exploit.

For the most part, all you need to know about SSH is that from the Terminal application located inside the Utilities folder in the Applications folder you can access your account on a remote system by typing

ssh <username>@<ip address or hostname>

(The specific information for your computer is shown at the bottom of the Sharing pane after SSH is enabled.)

After you enter this command, the remote machine prompts you for the account password and then gives you full control over your account and the resources you have access to. It’s as if you launched the Terminal application directly on the affected computer. (If you’re wondering what exactly you can do with SSH, don’t worry! We’ll talk more about using the command line from the Terminal in Chapter 38, “Using Basic Unix Commands.”)’If you’re not interested in the command line, don’t worry—there’s absolutely no reason why you have to use SSH. If you prefer a GUI solution to remote system administration, check out Apple’s Remote Desktop application, mentioned in a note in the section “Sharing Services” earlier in this chapter. It allows you to do things such as use your work computer from home and vice versa.

Watch Out!

If you’re planning to serve FTP and SSH only occasionally, shut off the services in the Sharing pane until you’re ready to use them. This closes some potential points of attack on your computer. You can still use the Mac OS X clients and command line to access other SSH/FTP servers, but remote users can’t connect to your machine.

FTP

With FTP enabled via the Sharing preferences on your computer, a remote user can type into a Web browser a URL of the form:

ftp://<client number>.<ip address or hostname>

This tells the Web browser to contact the Mac OS X computer running the FTP server’. From there, the user is prompted to enter any valid username and password for the computer being accessed (as shown in Figure 34.8).

Authentication requires a valid username and password.

Figure 34.8. Authentication requires a valid username and password.

After a user has connected via FTP, a special icon appears on the desktop to represent the remote system that is now linked to, or mounted on, your desktop. When double-clicked, a Finder window containing the files on the remote system appears.

Although the built-in FTP option provides some basic FTP functions, most users prefer to use heartier third-party software. Here are some of the most popular options:

  • Fetch—fetchsoftworks.com/

    Fetch is a full-featured FTP client that allows you to resume file transfer if interrupted. (The cursor appears as the silhouette of a running dog to show when transfers are in progress.) A 15-day trial is available.

  • Interarchy—www.interarchy.com/

    Interarchy allows you not only to transfer files but also to diagnose connection problems.

  • Transmit—www.panic.com/transmit/download.html

    Transmit allows you to transfer files and create a list of frequently accessed servers—all in a user-friendly interface. You can download a free trial version that doesn’t expire, but you will have to purchase Transmit to unlock all the features.

If you need to share files over the Internet, FTP is one of the best ways to do so. It’s fast, effective, and an efficient protocol. Unfortunately, it’s also not easy to work with behind firewalls, and it transmits its passwords unencrypted. If you set up a nonadmin user account, perhaps called Transfers, for the sole purpose of moving files around, the password issue shouldn’t be much of a problem. Firewalls, on the other hand, are something you might need to discuss with your network administrator before you activate FTP.

You learn how to use FTP from the Finder in the next section.

Connecting to Shared Folders

Your Mac OS X computer can connect to a number of types of network resources from the Finder, specifically:

  • Macintosh systems—Other Mac computers that are sharing files via AppleTalk or AppleShare IP.

  • Windows/Linux computers—If Windows or Linux computers are using SMB or CIFS file sharing (the standard for most Windows networks), your Mac can access the files easily.

  • WebDAV shares—WebDAV is a cross-platform file sharing solution that uses the standard Web protocols. The .Mac iDisk storage uses WebDAV.

  • FTP servers—File Transfer Protocol servers are a popular means of distributing software on the Internet. Your Mac OS X machine can connect (read-only) to FTP servers.

  • Linux/BSD NFS servers—NFS is the Unix standard for file sharing. Your Mac (being Unix!) can obviously talk to them as well.

To connect in these various ways, choose Go, Connect to Server (Command-K) from the Finder menu. This opens a new dialog box, shown in Figure 34.9, that enables you to connect to remote computers.

The Finder has the power to connect you to remote volumes directly.

Figure 34.9. The Finder has the power to connect you to remote volumes directly.

To make the connection to Macintosh and Windows servers, enter the address of the server you want to access and then click Connect. After a few seconds, you’re prompted for a username and a password, as shown in Figure 34.10.

Enter a valid username and password, and then click Connect.

Figure 34.10. Enter a valid username and password, and then click Connect.

Click Connect. You may then see a window similar to Figure 34.11 where you can choose different accounts on the remote computer. After you choose one and click OK, the volume is mounted on your desktop. Double-click the icon to access the remote computer.

Select the volume you want to mount.

Figure 34.11. Select the volume you want to mount.

By the Way

If you’re connecting to another Mac OS X computer, you can use either an account holder’s full name or username to connect. You must enter a valid password for that account.

Connecting to WebDAV and NFS shared volumes is similar.

Your network administrator should be able to give you the exact information you need, but for the most part, the URLs follow a format like this:

FTP shares: ftp://<server name>/<shared volume>

For example, I have an FTP server named Xanadu on my network (poisontooth.com) containing a folder called waternet at the root level of the server. To access it, I would type ftp://xanadu.poisontooth.com/waternet and then click Connect.

WebDAV is even simpler. WebDAV shares are actually just Web resources, so they use the same URLs that you would type into your Web browser. For example, to access the iDisk storage of your Mac.com account, you would type

http://idisk.mac.com/<your Mac.com username>.

NFS follows the same pattern. If the remote server is configured to allow connections, an NFS connection URL looks like this: nfs://<server name>/<shared volume>.

By the Way

Windows and Macintosh shares can also be mounted via the URLs prefixed with SMB:// and AFP://, respectively.

Connecting from a Windows Machine

Earlier in this chapter, you learned how to enable Windows Sharing. Now, we’ll talk about how someone on a Windows computer can connect to your computer.

By the Way

The following steps are for Windows XP. Those running different versions of Windows may have to consult other documentation because some features may be labeled, or even accessed, differently.

There are essentially two options for connecting. For a Windows computer on your own network, you can browse to a shared Mac account in the following way:

  1. Open the Control Panel from the Windows Start menu.

  2. Choose Network and Internet Connections from the items under the header Pick a Category.

  3. Choose My Network Places from the list along the left with the header See Also.

  4. Under the header Network Tasks, choose View workgroup computers.

  5. Under the header Other Places, choose Microsoft Windows Network.

  6. Double-click the Workgroup icon to see a screen similar to Figure 34.12, in which the shared Mac appears as an option.

    Choose a Mac that’s part of the current PC’s Windows Workgroup.

    Figure 34.12. Choose a Mac that’s part of the current PC’s Windows Workgroup.

  7. Double-click the desired Mac OS X Client to initiate contact. You then have to enter the username and password of the Mac account holder to access the account.

By the Way

Keep in mind that the person logging from Windows must be identified as the same user the Mac account recognizes, meaning that it is necessary to log in to Windows using the username and password of the account on Mac OS X. Be sure to enter your username in all lowercase characters and the password just as you entered it in Mac OS X.

After logging in, the Windows user double-clicks the account icon to view the folders in the Mac user’s account, as shown in Figure 34.13.

The familiar files of an OS X user’s home folder in an unexpected interface!

Figure 34.13. The familiar files of an OS X user’s home folder in an unexpected interface!

For Windows XP users outside your local network, the connection process requires them to map a path to your shared account using the address displayed in the Sharing pane when you enabled it for Windows Sharing (similar to the address shown at the bottom of Figure 34.3.)

Here are the steps to map a networked drive:

  1. Open the Control Panel from the Windows Start menu.

  2. Choose Network and Internet Connections from the items under the header Pick a Category.

  3. Choose My Network Places from the list along the left with the header See Also.

  4. Choose Add a Network Place from the list along the left with the header Network Tasks.

  5. A wizard appears to guide you. Click Next and select the Choose Another Network Location option.

  6. Click Next to see the screen shown in Figure 34.14. There, type the path given in the Sharing pane of your Mac. (Be sure to type it exactly as shown, including the back-slash characters.) Then click Next. You may have to wait a moment as the Windows computer locates the requested account.

    Enter the path to the shared Mac OS X account carefully.

    Figure 34.14. Enter the path to the shared Mac OS X account carefully.

  7. If all goes well, you see the screen shown in Figure 34.15, where you can give a name to the network place your computer has just identified. Click Next.

    Give a short but descriptive name to the shared account.

    Figure 34.15. Give a short but descriptive name to the shared account.

  8. The final screen of the wizard requires you to click Finish to wrap things up.

To connect to a mapped network drive, open the Control Panel and choose Network and Internet Connections. Under the See Also heading on the left side of the window, choose My Network Places. You will see the place you just added under the Internet header in the middle of the screen. You can double-click it to view the folders in the Mac user’s account, as shown previously in Figure 34.13.

Sharing Your Internet Connection

If you have multiple computers that need access to the Internet but only one Internet connection, you can set up Mac OS X to share the connection it has with other computers on your network. Here are some possible configurations:

  • If your primary connection is via AirPort, any machines connected to it via ethernet can connect to the Internet.

  • If your primary connection is an ethernet connection, your machine can become an AirPort base station and share its connection to others using AirPort wireless technology (assuming that the sharing computers all have AirPort cards). It can also share with other computers using ethernet.

  • If your connection is a modem, your machine can share connections through both AirPort and ethernet.

Watch Out!

Even though this sounds like a truly wonderful feature, it should be used with caution. Some network arrangements can be disrupted when their member computers start sharing Internet connections. Check with your network administrator, or any nearby network administrators of wireless networks, before you try this.

To share your Internet connection, open the Internet section of the Sharing System Preferences pane, shown in Figure 34.16, set the Share Your Connection From pop-up menu to the type of connection used, and check the box for the type of connection to the computers that will be connecting. After you have these settings in place, click the Start button.

Share your network connection with a friend.

Figure 34.16. Share your network connection with a friend.

Summary

The Macintosh has always made it simple to share file information between computers. Mac OS X keeps the process simple but imposes some limitations that users might not be prepared for. At the same time, it opens up compatibility with Windows and Linux computers by adding SMB/CIFS and WebDAV support. In addition to the standard file sharing services, Mac OS X can be configured to act as an FTP or SSH server, making it possible to access information and control your computer from anywhere on the Internet.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset