Depending on the type of server access (local vs. remote) and the operating systems of both your local computer and the remote server, you may need to use different commands and tools to find available NFS (Network File System) shares on a distant server.
For Linux/Unix Clients
1. Using showmount Command
The showmount command is the most straightforward way to list available NFS shares on a remote server. You'll need the remote server's hostname or IP address.
showmount -e <remote_server_hostname_or_IP>
- Example: showmount -e 192.168.1.100
- Output: This will display the remotely mounted directories along with the clients they are mounted to, if any.
2. Using nmap for NFS Service Detection
If you suspect NFS might be running on a non-standard port or want to verify if the NFS service is active without directly querying the server (in cases where direct queries are blocked or limited), nmap can help detect the NFS service.
nmap -sT -p 111,2049 <remote_server_hostname_or_IP>
Ports:
- 111 is for the portmapper service (rpcbind), which manages RPC services, including NFS.
- 2049 is the default NFS port (for NFSv4 and later; earlier versions might use other ports, but 2049 is a good starting point).
3. Accessing and Listing Shares with mount
If you have the necessary permissions and want to temporarily mount and inspect an NFS share:
Create a Mount Point:
mkdir ~/nfs_temp
Mount the NFS Share:
sudo mount -t nfs <remote_server_hostname_or_IP>:<share_name> ~/nfs_temp
List the Contents:
ls ~/nfs_temp
Unmount When Done:
sudo umount ~/nfs_temp
For Windows Clients/Servers
1. Using Windows Command Line/Powershell to Enumerate NFS Shares
Windows does not natively support NFS client functionality out of the box for end-users, but if you have the Windows Services for UNIX (or Windows Subsystem for Linux in newer Windows versions), you can use the showmount command as described above within the Linux subsystem.
For native Windows approaches, especially in a server context with Windows Server supporting NFS sharing:
For Windows Server Administrators
Use the Server Manager or Powershell to manage NFS shares. You can list NFS shares with Powershell:
Get-NfsShare
To Access NFS Shares from a Windows Client: You typically need to map the network drive. The process involves:
- Open File Explorer, right-click on This PC, and select Map network drive...
- Specify the Folder: Use the format \\<server_name>\<share_name> (e.g., \\192.168.1.100\my_share)
- Finish the Wizard: Follow through the rest of the wizard, possibly requiring credentials depending on the share's security settings.