/etc/exports: Explanation & Insights

Directories that can be accesses through NFS

The /etc/exports file is a configuration file used by the Network File System (NFS) to specify which file systems or directories can be accessed remotely by other computers on the network. This file determines which files or directories are exported, and to which clients they are exported, as well as the type of access allowed for each export.

Here's an example of how to configure an export in the /etc/exports file:

/export/home *(rw,sync)

In this example, /export/home is the directory that is being exported. The * wildcard specifies that any client can access this export. The rwoption allows read and write access to the files and directories within the export, and the sync option specifies that the server should write changes to the disk immediately.

Another example:

/data 192.168.1.100(rw,no_root_squash) 192.168.1.101(ro)

In this example, /data is the directory that is being exported. The first IP address 192.168.1.100 is a client that has read and write access to the export, and the no_root_squash option allows the client to have root-level access to the files and directories within the export. The second IP address 192.168.1.101 is a client that has read-only access to the export.

You can add as many exports as you need in the /etc/exports file, with different options and access permissions for each one. It's important to note that after modifying the /etc/exports file, you need to restart the NFS service for the changes to take effect.

The text above is licensed under CC BY-SA 4.0 CC BY SA