exportfs
Make directories available for NFS sharing
SYNOPSIS
exportfs [-avi] [-o options,...] [
exportfs -r [-v]
exportfs -ua [-v]
exportfs -f
PARAMETERS
-a
Export or unexport all directories listed in /etc/exports.
-o options,...
Specify NFS export options for the directory, as defined in exports(5).
-i
Ignore the /etc/exports file. This is useful for testing configurations.
-r
Re-export all directories. This effectively refreshes the export list by first unexporting everything and then exporting according to /etc/exports.
-u
Unexport a specific directory. Requires a host:dir argument.
-ua
Unexport all currently exported directories.
-v
Verbose mode. Displays more information about the export operations.
-f
Just fake the export of a directory. This creates a dummy entry in /var/lib/nfs/etab, but does not actually export the directory. This is useful for testing configurations.
host:dir
The host or network allowed to access the specified directory. The host can be specified using various formats. dir is the full path to the exported directory.
DESCRIPTION
The exportfs command is used to manage the table of NFS (Network File System) exported file systems. It allows administrators to export or unexport directories, making them available or unavailable to NFS clients. It effectively updates the /var/lib/nfs/etab file, which NFS server daemons use to determine which file systems are shared and with what options. Without any options, exportfs will re-export every directory listed in /etc/exports. It is a crucial command for configuring and maintaining NFS servers, enabling secure and controlled file sharing across a network. Proper use of exportfs ensures that only authorized clients can access specific file systems with the appropriate permissions. Incorrect configuration can lead to security vulnerabilities or denial of service. When making changes to /etc/exports, exportfs is usually the tool you use to inform the NFS server about the changes. Remember to restart the nfs service for those changes to persist after reboot.
CAVEATS
Changes made using exportfs might not persist across reboots if not properly configured in /etc/exports. Incorrect syntax or conflicting options in /etc/exports can lead to unexpected behavior. Using * as the network will make the folder accessible to anyone. Verify the security concerns before allowing anyone to access the folder.
RETURN CODES
The exportfs command returns 0 on success and a non-zero value on failure. Check the error messages for details on the cause of failure.
EXAMPLE USE CASES
exportfs -a
Exports all directories specified in /etc/exports.
exportfs -au
Unexports all currently exported directories.
exportfs -o ro,root_squash 192.168.1.0/24:/srv/nfs
Exports /srv/nfs to the 192.168.1.0/24 network with read-only permissions and root squashing.
HISTORY
The exportfs command is a core utility for managing NFS exports, tracing back to the early implementations of NFS in Unix-like systems. Its primary function has remained consistent: controlling which directories are shared over the network via NFS. Over time, its features and options have evolved alongside NFS itself, adapting to new security requirements and network architectures.
SEE ALSO
nfsd(8), mount(8), exports(5), showmount(8)