MacHome Magazine, July 2002 issue
Have Files? Can Travel
by Mykael Biancalana
Accessing Files Remotely
Have you ever wished you could access files on your home computer while at work or on the road? Or perhaps you'd like to share select files with friends, family, and co-workers. In recent issues we've explored the file sharing capabilities of your Mac, but did you know that both Mac OS 9 and Mac OS X also come with built-in personal web servers?
In this installment of Home Networking, we'll show you how to host a website and retrieve files from your Macintosh from a remote location, using an Internet connection and a web browser like Navigator or Explorer, regardless of platform or operating system.
To get started you'll need the following:
The first step in this simple process is to enable file sharing on your Mac. Launch the File Sharing control panel by selecting Control Panels>File Sharing from the Apple Menu. Make sure that there is an owner name and owner password specified. If not, then click the Start/Stop tab and enter your name, a password, and a name for your computer. It would be best to use a unique password with a least eight numbers, letters, and special characters, such as a dollar or percent sign, when assigning a password. (See our May 2002 issue on network security for more tips on choosing passwords.) Check the "Enable File Sharing clients to connect over TCP/IP" box and click the Start button. File sharing will start, and the Start button will become the Stop button. You will also see an item that says "Program Linking." Ensure this option is turned off so that users cannot run programs remotely.
Now you must specify who will have access to the files you want to share. Click the Users & Groups tab to display the names of everyone who as access to your files.
Click the New User button. Enter a name and password for each new user. If you want to allow users to change their password on their own, leave the "Allow user to change password" box checked. Close the New User window.
The next step is to identify which files and folders you want to share. In the Finder, create a new folder to contain the files and folders you want to share; a recommended name can be Sharefolder. Select it, and choose Get Info>Sharing from the File Menu.
Check the "Can't move, rename, or delete this item" box. Check the "Share this item and its contents" box and select the Owner from the drop-down menu. Finally, assign privileges for the folder - either Read & Write, Read Only, or Write Only. Because your system is accessible from the outside, we recommend Read Only. Close the Get Info window.
Finally, enable web sharing on your Mac. Open the Web Sharing control panel by selecting Control Panels>File Sharing from the Apple Menu. Make sure to jot down the Internet Protocol (IP) address under Web Identity. This number identifies your computer (or home network) on the Internet - you'll need it to find your computer through the Internet (we'll cover this a little later). Next, click the Web Folder Select button to point to the folder we designated as Sharefolder. If you want to serve web pages, click the Home Page Select button to specify a HyperText Markup Language (HTML) file to use as a home page. Then, check the radio button "Use File Sharing to control user access" and click the Start button. Web sharing will start. Close the Web Sharing control panel.
Mac OS X Web Sharing Setup
Every copy of Mac OS X comes with a built-in Apache web server. Apache, considered by many the de facto standard, is the Internet's most popular, stable, extensible and feature-laden web server available.
To start, make sure you are already logged in to your Mac with an account that has administrator privileges (if you are the only user, you are probably listed as the owner/administrator). If not, log in using an administrator account.
Now you must specify who has access to the files you want to share. Select System Preferences from the Apple Menu, then click on Users. This preference will display the names of everyone who has access to your files. If you need to add additional users, click the New User button. As in Mac OS 9, enter a name and password for the new user, then close the window.
To activate web sharing, select System Preferences from the Apple Menu and then click Sharing. This opens the Sharing preference. You may need to click on the lock icon and enter your user password. As with Mac OS 9, it's important to jot down the IP address. Now click the Start button to begin web sharing.
Your files are now available and accessible through the Internet using any PC equipped with a browser.
Accessing Your Files Remotely
To access your files remotely you will need the following:
To access your files at home from any remote PC simply establish an Internet connection, launch the web browser and enter the IP address in the address bar of your web browser as a valid Uniform Resource Locator (URL). For example, if your IP address is 126.96.36.199, then enter http://188.8.131.52 for a Mac OS 9 server, or http://184.108.40.206/-user-name/ for a Mac OS X server. Your web browser will display either the HTML home page you specified or a listing of the contents of Sharefolder. Click on a link to view or save the files. You can view plain text documents and graphic files (GIF's, JPEG's, and so on) within the browser window.
As with most technoloiges, there are a few limitation to this type of web hosting. The main drawback is the single file restriction. As you may know, browsers allow you to select only one link at a time. You can circumvent this problem and reduce file sizes by creating compressed archives that contain groups of files you want to share. If you'll be picking up files from a PC, you'll want to use a program that creates Zip files or self-extracting Windows archives. Here are two programs for creating ZIP files and Windows archives:
Some users, especially those with home networks, may encounter problems getting past the firewall between the Internet and their home networks' IP address. This creates a twofold problem. First, you'll have to look up your real network IP address in the router's configuration utility. Second, you'll have to tell your router which machine is set up as a web server. Not to worry though - most hardware and software routers allow you to forward web server traffic to a specific machine on your network. Depending on what hardware or software you use, manufacturers may refer to this technique as port forwarding, pin holing, or virtual server mapping. Consult your router manual to enable this feature on your home network.
Another problem some users may face is the issue of dynamically assigned IP addresses. Some DSL, cable and satellite users may receive a different IP address each time they connect. If this is the case, we recommend using one of the third party dynamic DNS services below:
Sign up with one of them (it's free) and they'll give you a domain name you can use in place of the IP address. Their domain name will follow your machine even if your IP changes. Then you can reach your home machine remotely by entering http://mymac.homeip.net in your web browser. MH
Mykael Biancalana is a Senior Networking Consultant for The Tiny Net, a networking company in San Francisco, CA, that specializes in networking for homes and small businesses. Visit them online at www.thetinynet.com.