In addition to sharing your computer with other users, the Mac makes it easy to share files with other computers on the same network and over the Internet. At the same time, some limitations are placed on what you can share that might require changes in the way your Macintosh network is set up.
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 10.2, you can enable or disable all the standard information-sharing services from the Services tab of the Sharing panel in System Preferences, as shown in Figure 27.7.
Figure 27.7. The Services tab of Sharing Preferences enables you to choose which sharing services you want run running on your computer.
You can enable or disable the following services:
Now, let's take at look at sharing 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 using the TCP/IP-based Service Locator Protocol (SLP) and Rendezvous to provide this functionality on modern Mac networks. Unfortunately, until everyone is running Mac OS X, you might still need to enable AppleTalk to access older devices.
Follow these steps to share your files with another Mac user:
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.
Activating Windows Sharing (Samba)
Windows computers use a system called SMB (Simple Message Block) for file and print sharing. To share files with Windows computers, your Mac uses the same protocol through a piece of software called Samba.
To turn on Windows Sharing (Samba), open the Sharing System Preferences panel to the Services tab, and then either click the check box in front of the Windows File Serving line, or highlight it and click the Start button. The Sharing panel 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 27.9.
Figure 27.9. Activate Samba for file sharing with Windows computers by using the Sharing preference panel.
Like AppleShare file sharing in Mac OS X, the built-in Samba configuration is limited to sharing each user's home directory. By default, none of the user accounts are enabled for login. Enable login from Windows by opening the Accounts System Preferences panel, selecting the user to have Samba access, and then clicking the Edit User button. Your screen will look similar to Figure 27.10.
Figure 27.10. Edit the user accounts that should be able to access your computer from Windows.
If necessary, enter the current user password, press the Return key, and then click the Allow User to Log In from Windows check box. The home directory of the user can now be accessed through a path following the format:
\ <hostname or IP address> \ <username>
Keep in mind that the person logging in from Windows must be identified as the same user the Mac account recognizes, meaning 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.
Activating Web Sharing
Mac OS X makes it easy to run a simple Web server from your own personal computer, using popular server software called Apache. What makes this so astounding is that Apache is actually the server that powers most Internet Web sites. It's built to run extremely complex sites, including e-commerce and other interactive applicationsand it's running on your desktop.
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 panel (shown in Figure 27.7), 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 the URL shown at the bottom of the window, and then start Internet Explorer to verify that your personal site is online.
To test this, launch a web browser, such as Internet Explorer, and enter your personal Web site URL, which should look like the following:
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 be 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 27.11.
Figure 27.11. Apple includes a default personal home page.
To edit your Web site, just look inside the Sites folder in your user account. The default page is generated from the file index.html and the Images folder.
If you're the adventurous sort , you've probably tried typing in the URL of your machine without including the ~ <username> portion. If you haven't, try it now. What you should see is that a different Web page loads. 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 located in /Library/WebServer/Documents . Any administrator can make changes to this directory, so be 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.
Activating Remote Login and FTP
Two additional methods of file sharing available are FTP and SSH. File Transfer Protocol provides cross-platform file-transfer services so others can connect to your computer and download files. The second type of sharing, SSH (secure shell), enables a remote user to send commands to a Mac OS X computer from anywhere in the world.
As you might expect, both of these protocols can be turned on using the Sharing System Preferences panel. SSH is turned on through the Remote Login check box, as you saw in Figure 27.7. Activate FTP by simply 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 panel: Remote Login, is an entirely 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. Contrary to the sentiment many Mac users have, the command line is not evil! In Mac OS X, it's a very powerful and entirely optional tool. As you start to explore the command line later in this book, you'll understand that it can be used to manage your files, monitor your system, and even control server processes.
SSH isn't the command line itself, but 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.
If you're not interested in the command line, don't worrythere's absolutely no reason why you have to use SSH.
With FTP enabled, someone in another place can reach files on your machine by typing the following into an FTP application:
ftp:// <mac os username> : <mac os password> @ <ip address or hostname>
This tells the Web browser to contact the Mac OS X computer running the FTP server, login with the given username and password, and display the files in that user's home directory.
If you have the need to transfer large files between computers over the Internet, here are several FTP clients that can be used to access remote FTP servers:
If you need to share files over the Internet, FTP is one of the best ways to do so. It's fast, effective, and a very 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 will learn how to use FTP from the Finder in the next section.