Hack 73 Sharing Files Between Mac and Windows PCs

figs/moderate.giffigs/hack73.gif

Apple has incorporated technologies into Mac OS X that allow easy file sharing across platforms.

Mac users often have to share files with Windows machines, both at work and at home. Occasionally, using portable media such as a ZIP disk or USB portable storage does the job nicely, but for daily use a cross-platform network is more robust. Apple has incorporated technologies into Mac OS X that allow easy file sharing among platforms. And with the release of Mac OS X 10.2, networking became even easier.

In this hack, we'll discuss how you can share files between your Mac and Windows machines. All the examples have been tested with Mac OS X 10.2.1.

73.1 Systems Configuration

I have an eMac and a Pentium 4 PC (an HP notebook). I used an Ethernet cable to connect the two machines directly. The nice thing here is that I can use a straight cable to connect both machines, and my eMac is able to automatically detect that it is connecting to a PC. There is no need for a cross cable here.

73.2 Viewing PC Files from a Mac

The first thing I want to try after connecting my two machines is to enable file sharing. On my PC, I create a folder and share it using the name Macshare. On my Mac, I want to be able to access that folder. To connect to the shared folder, select Go from the Finder menu and click Connect to Server.

You should be able to see the PC name displayed, as shown in Figure 6-21. Select the PC and click Connect.

Figure 6-21. Connecting to a server
figs/xh_0621.gif

You will be prompted to enter the credentials to log on to the PC (domain/workgroup, username, and password).

If the connection is successful, you will see the share icon (see Figure 6-22).

Figure 6-22. The share folder on the Desktop
figs/xh_0622.gif

You can now browse the folder as though it is a local drive.

73.3 Viewing Mac Files from a PC

Because Mac OS 10.2 (Jaguar) contains a built-in SMB/CIFS server (Samba Version 2.2.3a), viewing Mac files on the PC is straightforward. You can use your Network Neighborhood to view the shared folders on your Mac. To do that, you need to turn on the Windows File Sharing on your Mac and check the "Allow user to log in from Windows" option, as shown in Figure 6-23. If the account you are setting is yourself, you need to type your password into the Current Password field before you can change the checkbox.

Figure 6-23. Allowing users to log in from Windows
figs/xh_0623.gif

SMB stands for Server Message Block. It's a lightweight protocol designed to allow the sharing of files and printers in a small network. SMB has since been renamed CIFS, or Common Internet File System. Mac OS X 10.1 contains only the SMB client, and thus you can only use SMB to browse for files on the PC, not vice versa. Mac OS X 10.2 contains both the SMB client and server, and hence PC users can browse for files on a Macintosh. For more information on SMB and Mac OS X, please see the Mac OS X and SMB HOWTO (http://www.opensource.apple.com/projects/documentation/howto/html/osxsmb.html).

Besides this method, two alternative ways to share Mac files with PC users are to use Web Sharing or FTP.

To use Web Sharing (using the built-in Apache web server), check the Personal Web Sharing item under the Services category in your System Preferences, as shown in Figure 6-24. Likewise, to allow FTP access, check the FTP Access checkbox. By default, the folder exposed by the web server is ~/Sites.

Figure 6-24. Enabling FTP access
figs/xh_0624.gif

The FTP services, though, expose the user's home directory, as shown in Figure 6-25. Hence, to share out any files on the Mac, you simply copy them to the respective folders, and they can then be accessed through FTP.

Figure 6-25. Home directory via FTP
figs/xh_0625.gif

To access the Mac files using FTP, you can use the command window in Windows and issue the following command (see Figure 6-26):

C:\>ftp IPAddressOfYourMac 
Figure 6-26. FTP from Windows to Mac
figs/xh_0626.gif

You can find out the IP address of your Mac in System Preferences Network TCP/IP.

For Web Sharing, you can use a web browser, such as IE, and enter the IP address of the Mac, followed by ~/username/ (see Figure 6-27).

Figure 6-27. Browsing a web share
figs/xh_0627.gif

Wei-Meng Lee and Brian Jepson



Mac OS X Hacks
Mac OS X Hacks: 100 Industrial-Strength Tips & Tricks
ISBN: 0596004605
EAN: 2147483647
Year: 2006
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net