[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 2

exportfs Command


Exports and unexports directories to NFS clients.


/usr/sbin/exportfs [ -a ] [ -v ] [ -u ] [ -i ] [ -fFile ] [ -oOption [ ,Option ... ] ] [ Directory ]


The exportfs command makes local directories available for Network File System (NFS) clients to mount. This command is normally invoked during system startup by the /etc/rc.nfsfile and uses information in the /etc/exports file to export one or more directories, which must be specified with full path names.

The /etc/xtab file lists directories that are currently exported. To display this file, enter the exportfs command without flags or arguments. To alter the file or to alter the characteristics of one of its directories, root users can edit the /etc/exports file and run the exportfs command. Such alterations can be done at any time. Never edit the /etc/xtab file directly.

Note: You cannot export a directory that is either a parent directory or a subdirectory of one that is currently exported and within the same file system.


-a Exports all directories listed in the exports file.
-v Prints the name of each directory as it is exported or unexported.
-u Unexports the directories you specify. When used with the -a flag, unexports all directories listed in the exports file.
-i Allows the exporting of directories not specified in the exports file or ignores the options in the exports file. Unless the -f flag is used to specify an alternate file, the exportfs command will normally consult the /etc/exports file for the options associated with the exported directory."
-f File Specifies an export file, instead of the /etc/exports file, that contains a list of directories that you can export. This file should follow the same format as the /etc/exports file. NOTE: This alternate file will not be used for exporting directories automatically when the system and NFS is started. The /etc/exports file is the only file that is supported for specifying directories to export at system start.
-oOptions Specifies optional characteristics for the exported directory. You can enter more than one variable by separating them with commas. Choose from the following options:
Exports the directory with read-only permission. Otherwise, if not specified, the directory is exported with read-write permission.
rw = Client [:Client]
Exports the directory with read-write permission to the machines specified by the Client parameter and read-only to all others. The Client parameter can be either the host name or the network name. If a rw host name is not specified, the directory is exported with read-write permission to all.
anon = UID
Uses the UID value as the effective user ID, if a request comes from a root user.

The default value for this option is -2. Setting the value of the anon option to -1 disables anonymous access. Thus, by default, secure NFS accepts nonsecure requests as anonymous, and users who want more security can disable this feature by setting anon to a value of -1.

root = HostName[:HostName,...]
Gives root access only to the root users from the specified HostName. The default is for no hosts to be granted root access.
access = Client[:Client,...]
Gives mount access to each client listed. A client can be either a host name or a net group name. Each client in the list is first checked for in the /etc/netgroup database and then in the /etc/hosts database. The default value allows any machine to mount the given directory.
Requires clients to use a more secure protocol when accessing the directory.
Specifies a directory as the NFS Server public directory. This option only applies to AIX 4.2.1.


  1. To export all directories in the /etc/exports file, enter:

    exportfs -a 
  2. To export one directory from the /etc/exports file, enter:

    exportfs /home/notes

    In this example, the /home/notes directory is exported.

    Note: For this command to work, the /home/notes directory must be specified in the /etc/exports file.

  3. To unexport a directory, enter:

    exportfs -u /home/notes

    In this example, the /home/notes directory is unexported.

  4. To display the name of the directory currently being exported, enter:

    exportfs -v
  5. To export a directory that is not specified in the /etc/exports file, enter:

    exportfs -i /home/zeus

    In this example, the /home/zeus directory is exported without restrictions.

  6. To export a directory and give netgroup members permission to access this directory, enter:

    exportfs access=cowboys:oilers /home/notes -o 

    In this example, the /home/notes directory is exported and permits users of cowboys and oilers host machines to have access.

  7. To export a directory with different options from the /etc/exports file, enter:

    exports -i -o -root=zorro:silver /directory

    In this example, the /directory directory is exported and allows root user access to zorro and silver host machines, regardless of the access permissions specified in the /etc/exports file.


/etc/exports Lists the directories that the server can export.
/etc/xtab Lists currently exported directories.
/etc/hosts Contains an entry for each host on the network.
/etc/netgroup Contains information about each user group on the network.
/etc/rc.nfs Contains the startup script for the NFS and NIS daemons.

Related Information

The chnfsexp command, mknfsexp command, rmnfsexp command, showmount command.

How to Export a File System Using Secure NFS in . AIX 5L Version 5.2 Security Guide

List of NFS Commands, List of NFS Files, and Network File System (NFS) Overview for System Management in AIX 5L Version 5.2 System Management Guide: Communications and Networks.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]