Section 9.2. Network-Based Filesystems


9.2. Network-Based Filesystems

In addition to working with physical filesystems, Mac OS X supports a set of network-based filesystem protocols. These are used when you mount a filesystem from a machine elsewhere on the network and, for the most part, make a remote filesystem appear as though it were local to your computer. The network filesystem protocols supported by Mac OS X are:


Apple Filing Protocol (AFP)

The native network file-sharing protocol for Mac-based computers. Originally designed to work over AppleTalk, it now operates well over IP-based networks. Most connections to Mac-based filesystems will be AFP-based.


Service Message Block (SMB)/Common Internet File System (CIFS)

The native network file-sharing protocol for Windows-based computers. Known as SMB for most of its life, Microsoft started standardization of the protocol under the CIFS name in the late 1990s, but these efforts were never finalized. This protocol is implemented in Mac OS X by the Samba suite of software (http://www.samba.org).


Network File System (NFS)

An older, Unix-based network filesystem used by Linux, the various BSD systems, Solaris, AIX, and other Unix variants. NFS allows Unix machines to transparently share filesystems in such a way that the Unix user security model is preserved.


Web-Based Distributed Authoring and Versioning (WebDAV)

A set of extensions to HTTP that allows you to collaboratively edit and manage files on remote web servers. WebDAV is the native protocol used for mounting iDisk shares from .Mac. You can find more information about WebDAV at http://www.webdav.org.


File Transfer Protocol (FTP)

An older protocol, used to transfer files between machines, that's still in use on the Internet. Traditionally, FTP has been used with an FTP client (similar to how the Web is browsed with a web browser), but if you want, you can mount an FTP site as a drive.

9.2.1. Mounting a Network Filesystem

The Finder's Go Connect to Server menu (-K), shown in Figure 9-1, gives you a simple interface for mounting remote disks locally. There are four ways to connect to a remote server.

Figure 9-1. Connecting to a server with the Finder



Server Address

Here you can type the hostname or IP address of the server that you want to connect to. The Finder will assume that you want to connect via AFP if you simply enter a hostname or IP address, but you can also use a URL in this field to connect to the AFP, FTP, SMB, and WebDAV filesystems. Table 9-1 gives the syntax for these URLs.


Favorite Servers

A list of servers that you can add by clicking the plus (+) button next to the Server Address field. Use this for servers that you connect to frequently.


Recent Servers

The Clock button gives you access to the servers you have recently connected to. You'll see these recent servers by URL, as shown in Figure 9-1.


Browse

When you click the Browse button, a Finder view opens, focused on the Network view, as shown in Figure 9-2. This provides you with access to the various Mac- and Windows-based filesystems available on the local network.

Figure 9-2. The Network browser in the Finder


When you connect to a network-based filesystem using Connect to Server, it shows up as a drive in the Finder and is mounted into the filesystem in the /Volumes directory. If you want to mount a network-based filesystem into a directory other than /Volumes, you'll need to use the mount command-line utility. The mount command has the following general syntax:

     mount -t filesystemtype url mountpoint

The -t option lets you specify the type of filesystem you want to mount. The mountpoint must be a directory that already exists in the filesystem. For example, to mount a .Mac user's Public folder, issue the following commands:

     $ mkdir -r /Disks/iDisk     $ mount -t webdav http://idisk.mac.com/runningosx-Public /Disks/iDisk

The first command uses mkdir to create a directory and subdirectory in the filesystem that you can use for mounting a disk volume. The second command actually mounts the iDisk Public folder, which belongs to the .Mac member named runningosx, into the /Disks/iDisk directory.

There are also specific mount command variants for each protocol. These are listed in Table 9-1.

Table 9-1. Network filesystem types, URL syntax, and command-line mount utilities

Protocol

Filesystem type

URL syntax

Command-line mount utility

AFP

afp

afp://[user]@host/[volumename]

mount_afp

FTP

ftp

ftp://[user]@host/[path]

mount_ftp

NFS

nfs

nfs://[user]@host/[path]

mount_nfs

SMB/CIFS

smbfs

smb://[user]@host/[sharename]

mount_smbfs

WebDAV

webdav

http://[user]@host/[path]

mount_webdav


9.2.2. Sharing a Network Filesystem

Of course connecting to another machine's filesystem is only half of the equation. You also need a way to share out your Mac's disks to other users. Mac OS X's versatility makes it an excellent solution for cross-platform file sharing . Using System Preferences, you can enable several different protocols that clients can use to connect to your Mac. These protocols can be broken down into two main groups: those that are Internet-based and those intended for Local Area Networks (LANs).

9.2.2.1. Sharing to Internet users

The two services provided with Mac OS X for Internet sharing are perhaps the most pervasive on the Web: FTP and HTTP. For HTTP, Apple has chosen the extremely popular Apache httpd daemon. Easily the most used web server on the Internet, Apache adds Mac OS X as yet another entry in its list of supported platforms. It's a reliable, proven Unix daemon whose complexity is belied by the simplicity of setting it up on your Mac.

9.2.2.2. Sharing to web users

When you enable Personal Web Sharing (System Preferences Sharing Services), the httpd web server daemon is started and starts serving pages from the following locations:

  • Pages in the /Library/WebServer/Documents folder are served when you make a request to your machine. For example, to browse the pages on the machine that you are serving from, you can point your web browser at http://localhost.

  • Pages in each user's Sites directory are served for requests to http://localhost/~username.

Apache's configuration file is located at /etc/httpd/httpd.conf. For the most part, this is a standard Apache configuration file, with just a few changes made to adapt it to Mac OS X. Any of the standard Apache configuration directives will work in this file. To access the locally installed documentation on how to configure Apache, browse to http://localhost/manual/ on your machine after turning on Personal Web Sharing. You can also find this documentation in the /Library/Documentation/Services/apache directory.

For more information on configuring Apache, see Apache: The Definitive Guide, Third Edition, by Ben Laurie, et al. (O'Reilly), or the Apache Pocket Reference, by Andrew Ford (O'Reilly).

When adding configuration directives to Apache's configuration, consider creating a file in the /etc/httpd/users directory that uses the .conf extension. Files in this directory that match the pattern *.conf are automatically included by httpd.conf. By making your edits in subfiles, you'll keep your configuration files neater as well as avoid potential conflicts from updated httpd.conf files that may be installed as part of future system updates.


HTTP is the workhorse of the Web. For the most part, however, HTTP is intended to send data in a single directionout. A web browser requests a file, and the HTTP server sends it back. Even though WebDAV and HTML forms allow a user to push a file or information onto the server, the majority of HTTP transactions occur in one direction: server to client. This leaves administrators with a bit of a gap when it comes to putting data on the server.

Long before HTTP came into the limelight, FTP was the primary way files were moved around Internet. Unfortunately, FTP was developed in a time when the Internet was still nascent and the worms, viruses, Trojan horses, and other baddies we see on the Net today were unheard of. Security was never a priority for FTP like it has been for its successors, sftp and rsync. Luckily, FTP is disabled by default on Mac OS X, and you may want to leave it that way. However, if you want to turn it on, you can in the Sharing preference panel. When you do, you can connect to your Mac with any FTP client, and you'll be able to access the contents of your entire system.

FTP Clients

Over the years, there have been several different FTP clients developed for the Mac. Perhaps the most popular is Panic's Transmit (http://www.panic.com/transmit). Transmit offers a very friendly FTP experience to Mac users. The latest release even has a Dashboard Widget for use with Tiger.

If shareware apps aren't within your budget, there are also a number of open source FTP applications available for Mac OS X. As a matter of fact, there's a command-line FTP client included with Darwin named simply ftp (take a look at the ftp manpage for more information).


9.2.2.3. Sharing to local network users

The Internet has ushered in a variety of tools for moving files around. Most of them also work on a local area network, but there are still other protocols that lend themselves particularly well to file sharing on a LAN. Mac OS X includes support for two of these protocols that are quite prevalent on today's networks. The Apple Filing Protocol (AFP) has been a part of Mac networking since the beginning. SMB (Server Message Blocks), implemented with the Samba package, has been the standard protocol for file sharing on Windows networks. This protocol support makes Mac OS X an excellent citizen on just about any kind of network environment you might come across.

9.2.2.4. Sharing to Mac clients

When you enable Personal File Sharing in the Sharing preference panel, Mac OS X starts the AppleFileServer process and sets up Bonjour so that other machines on the local network will be able to see that your machine will accept AFP requests. This makes your machine appear in the /Network folder in the Finder view of the other Macs on your local network and allows them to connect to your machine.

The shares (locations in the filesystem that can be accessed by others) that your Mac exposes to other machines vary depending on how users log into your machine:

  • If a user logs into a machine as a Guest, he will see a share for each user on the machine. Each user's share holds the contents of that user's Public folder. He won't be able to see any other files on the system.

  • If a user logs into a machine as a User with administrative privileges, she will be able to see a share for that user's Home folder as well as a share for each disk attached to the machine, including the boot disk.

  • If a user logs into a machine as a Normal User (without administrative privileges), he'll only see a share for that user's Home folder.

Mac OS X's Personal File Sharing feature works quite well on a network composed of all Mac clients. Sadly, such a network isn't nearly as common as some of us might hope. You're far more likely to find yourself on a network filled with Windows clients and servers. If you're behind enemy lines (or maybe just at the corporate office), Mac OS X's Windows Sharing will prove invaluable.

9.2.2.5. Sharing to Windows clients

When you enable the Windows Sharing checkbox in the Sharing preference panel, your Mac appears in the Network Neighborhood view of Windows Explorer, as shown in Figure 9-3. To connect to a Mac from a Windows machine, simply double-click the machine in Explorer and then enter the name and password of a user on the Mac.

In the Network Neighborhood, you'll find that Windows machines organize themselves within domains or workgroups. Your Mac initially sets its SMB workgroup to be WORKGROUP, but this can be changed using the Directory Access (/Applications/Utilities) application. Open Directory Access and select the SMB/CIFS entry, and then click the Configure button. On this sheet, you can configure the SMB workgroup to be used, as well as the Windows Internet Name Service (WINS) server, as shown in Figure 9-4.

Figure 9-3. Browsing a Mac share using Windows Explorer


Figure 9-4. Configuring SMB options


By default, when you enable Windows Sharing, only the Home folders of the users on the system will be shared and made available to other machines. You can easily modify this by editing the Samba configuration file located at /etc/smb.conf on your Mac. To edit the file, you'll need to use a command-line editor, such as nano, in conjunction with the sudo command to gain the necessary privileges:

     $ sudo nano -w /etc/smb.conf

To share a folder on your Mac, you must create an entry for it in the /etc/smb.conf file. Example 9-1 shows the basic format for a Samba share's entry. In Example 9-1, the folder /Users/Shared has been shared out with read/write access. The browseable parameter controls whether the share appears in Windows Explorer. Even if the browseable property is set to no, users can still access the share using the UNC path to the share (e.g., \\RONIN\SHARED). Finally, the create mode defines what Unix permissions new files will have on the share when they are created.

If you want to allow the Windows file-sharing service to share all available disks on your Mac similar to how AFP shares work, you can create a share for the /Volumes folder. When Mac OS X mounts a disk, disk image, or other volume, it is automatically linked to the /Volumes folder; however, this is a blanket approach, so be careful that you're not sharing something you'd rather keep private.


Example 9-1. A sample smb.conf entry
 [shared]   comment = Shared Directory   path = /Users/Shared   read only = no   browseable = yes   create mode = 755

For more information on configuring Samba, see either Using Samba, Second Edition, by Jay Ts, et al. (O'Reilly), or Samba Pocket Reference, Second Edition, by Jay Ts, et al. (O'Reilly). You can also find a wealth of information on Samba, including documentation and sample configuration files, at http://www.samba.org.




Running Mac OS X Tiger
Running Mac OS X Tiger: A No-Compromise Power Users Guide to the Mac (Animal Guide)
ISBN: 0596009135
EAN: 2147483647
Year: 2004
Pages: 166

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