73 Sharing Files Between Mac and Windows PCs





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.

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.

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. Select the PC and click Connect.

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).

The share folder on the Desktop
figs/xh_0622.gif

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

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. 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.

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. Likewise, to allow FTP access, check the FTP Access checkbox. By default, the folder exposed by the web server is ~/Sites.

Enabling FTP access
figs/xh_0624.gif

The FTP services, though, expose the user's home directory, as shown in Figure. 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.

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):

C:\>ftp IPAddressOfYourMac 
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).

Browsing a web share
figs/xh_0627.gif

—Wei-Meng Lee and Brian Jepson


     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows