|
 |
 |
To access the contents, click the chapter and section titles.
Complete Idiot's Guide to Linux
(Publisher: Macmillan Computer Publishing)
Author(s): Manuel Ricart
ISBN: 078971826x
Publication Date: 12/22/98
Chapter 23 Sharing Files over the Network
In This Chapter
- The Network File System
- Using the mount and umount Commands
- Navigating the File System with FTP
- Uploading and Downloading Files
- Controlling File Access
Sharing files over the network allows you to collaborate more easily with others. Linux has the capability to provide file-sharing services in many ways. You can also be a client to almost all popular network file-sharing schemes.
The most popular ways for sharing files under UNIX are FTP (File Transfer Protocol), NFS (Network File System), and HTTP (the Web). Other protocols, such as Gopher, have given way to Web counterparts. Windows-based PCs share files using the SMB (Server Message Block) protocol. Linux can easily be a client to an SMB server and provides you with an FTP-like interface to a server.
If the information here should awaken your interest, feel free to read the online documentation (see Chapter 15, Help Please). Accessing a service (being a client) is easy. Setting up a server is slightly (a few orders of magnitude) more complicated, and entire books have been written on the various subjects. Given the limited space, I have covered what I consider the least you should need to know to publish data and to access data from other servers.
NFS
The NFS is how you share files between UNIX-based machines. Originally developed by Sun, NFS is very flexible and could be used to share information between networks. However, exporting directories to networks outside your control requires careful security considerations. By design, NFS was not intended for sharing across the Internet, but given todays high-speed communication networks, it is feasible to share files over the Net.
NFS allows a directory tree to be grafted into the file system by other computers on the network in much the same way you mount a floppy disk or CD-ROM.
One issue with NFS is that file system security is based on the same mechanism your local file system uses: User IDs (UIDs) and Group IDs (GIDs) of files. If the UID of a user accessing a remote NFS volume doesnt match the users own, the user will lack the necessary privileges. This means that in order to use NFS effectively, there needs to be a mechanism that shares login and password information. Luckily, such a system does exist; it is called NIS (Network Information Services). A long time ago, NIS was called Yellow-Pages. Configuring NIS and NFS requires more depth of information than a few paragraphs can offer. This section will only show you how to export and import an NFS volume. For in-depth configuring information, you should consult the online documentation and how-to guides and perhaps even acquire a book on NIS and NFS. Linux implementation is fairly standard, and you should have no problem adapting that information to your system.
Exporting an NFS Volume
Before you can export NFS volumes, youll need to enable the NFS Server services in your computer. This is done through LISA under Configure daemon/server autostart under the System Configuration area; then youll need to reboot your computer. LISA, as you learned in Chapter 21, LISA: Linux Installation and System Administration Utility, is a command line program that manages your hardware and software configuration for the more important portions of your system.
With NFS, you dont need to export an entire disk volume; a directory of your choosing will suffice. To export a directory, you merely need to edit the file /etc/exports. When you export a directory, you choose how you make it available and the permissions that others may have on the volume. Typically, unless you know what you are doing, you should just export the volume read-only. This way, users can see and access files, but they wont be able to modify or delete files.
/share (ro,insecure,all_squash)
In the entry shown, /share is exported with several options; heres what they mean. The ro option requests that the file system be exported as read-only: Users will be able to see and access the files, but they wont be able to modify them. Insecure allows NFS clients that dont use a reserved port to access this volume. Typically, NFS will want to allow only clients of the service that connect on a specific port. The all_squash options maps all the UIDs and GIDs found in the files in /share to those of the anonymous user. This setting would export the /share directory to the world!
For more information on other options, read the man page on exports.
|