22.4. Exporting File Systems Manually

If you do not want to use YaST, make sure the following systems run on the NFS server:

For these services to be started by the scripts /etc/init.d/portmap and /etc/init.d/nfsserver when the system is booted, enter the commands insserv /etc/init.d/nfsserver and insserv /etc/init.d/portmap. Also define which file systems should be exported to which host in the configuration file /etc/exports.

For each directory to export, one line is needed to set which machines may access that directory with what permissions. All subdirectories of this directory are automatically exported as well. Authorized machines are usually specified with their full names (including domain name), but it is possible to use wild cards like * or ? (which expand the same way as in the Bash shell). If no machine is specified here, any machine is allowed to import this file system with the given permissions.

Set permissions for the file system to export in brackets after the machine name. The most important options are shown in Table 22.1, “Permissions for Exported File System”.

Table 22.1. Permissions for Exported File System

option

meaning

ro

The file system is exported with read-only permission (default).

rw

The file system is exported with read-write permission.

root_squash

This ensures that the user root of an importing machine does not have root permissions on this file system. This is achieved by assigning user ID 65534 to users with user ID 0 (root). This user ID should be set to nobody (which is the default).

no_root_squash

Does not assign user ID 0 to user ID 65534, keeping the root permissions valid.

link_relative

Converts absolute links (those beginning with /) to a sequence of ../. This is only useful if the entire file system of a machine is mounted (default).

link_absolute

Symbolic links remain untouched.

map_identity

User IDs are exactly the same on both client and server (default).

map_daemon

Client and server do not have matching user IDs. This tells nfsd to create a conversion table for user IDs. The ugidd daemon is required for this to work.

Your exports file might look like Example 22.1, “/etc/exports”. /etc/exports is read by mountd and nfsd. If you change anything in this file, restart mountd and nfsd for your changes to take effect. This can easily be done with rcnfsserver restart.

Example 22.1. /etc/exports

#
# /etc/exports
#
/home            sun(rw)   venus(rw)
/usr/X11         sun(ro)   venus(ro)
/usr/lib/texmf   sun(ro)   venus(rw)
/                earth(ro,root_squash)
/home/ftp        (ro)
# End of exports