When setting up a NFS server its nice to be able to test from your desktop to verify things are working properly. In the current scenario I setup NFS on a BackTrack Linux server and needed to test it quickly from OSX to make sure NFS mounts were advertising properly. Below are a couple quick commands to first display the available NFS mounts and second to mount the NFS drive on OSX to verify functionality.
Show Advertised NFS Mounts On Ubuntu Linux Server From OSX Desktop:
- macbook-pro:Desktop alex$ showmount -e 192.168.1.210
- Exports list on 192.168.1.210:
- /data/docs 192.168.1.0/24
- /data 192.168.30.0/24
- /data/isos/attack 192.168.0.0/16
- macbook-pro:Desktop alex$
The above output will display when the NFS or Network File Server mounts are being displayed properly. The Macbook Pro laptop has an IP in the 192.168.1.0/24 network range so you can see that regardless of the ability to mount the NFS share you will still be able to see it advertised. Below is another example showing an attempt to see NFS shares that are not being advertised properly.
Attempt To Show Advertised NFS Mounts On Windows Server From OSX Desktop:
- macbook-pro:Desktop alex$ showmount -e 192.168.1.53
- showmount: Cannot retrieve info from host: 192.168.1.53: RPC failed:: RPC: Unable to send; errno = Bad file descriptor
- macbook-pro:Desktop alex$
In the second example you can see there are not any NFS shares. The above example is querying a Windows 7 Ultimate server where I know there are shares however the default shares in Windows 7 will be using SMB and not NFS. So to cover all of your bases make sure to query the server for a list of open SMB shares as well using the syntax below.
Display SMB Shares On Windows 7 From OSX Command Line:
- macbook-pro:Desktop alex$ smbutil view //192.168.44.53
- Share Type Comments
- -------------------------------
- ADMIN$ Disk Remote Admin
- print$ Disk Printer Drivers
- share1 Disk
- IPC$ Pipe Remote IPC
- Users Disk
- C$ Disk Default share
- 6 shares listed
- macbook-pro:Desktop alex$
Last but not least if you need to actually mount the share quickly on OSX you can use the below syntax to create a temporary directory and mount a NFS share to view the contents of the remote folder.
Display SMB Shares On Windows 7 From OSX Command Line:
- macbook-pro:~ alex$ cd /Users/alex/Desktop
- macbook-pro:Desktop alex$ mkdir NFSTEST
- macbook-pro:Desktop alex$ sudo mount -t nfs 192.168.1.210:/data/docs /Users/alex/Desktop/NFSTEST/
- Password:
- macbook-pro:Desktop alex$
- macbook-pro:Desktop alex$ ls -alh NFSTEST/
- total 36
- drwxr-xr-x 5 root wheel 4.0K Nov 1 07:06 .
- drwxr-xr-x 99 alex staff 3.3K Nov 1 08:17 ..
- -rwxr--r-- 1 root wheel 200B Mar 5 2011 details.txt
- drwxr-xr-x 2 root wheel 4.0K Aug 9 17:59 pen
- drwxr-xr-x 2 root wheel 4.0K Mar 5 2011 poster
- -rwxr--r-- 1 root wheel 1.3K Aug 9 18:09 test3.txt
- drwxr-xr-x 2 root wheel 4.0K Mar 5 2011 treats
- -rwxr--r-- 1 root wheel 0B Mar 5 2011 xxxx.txt
- macbook-pro:Desktop alex$
There are plenty more switches that can be useful when used with the showmount, smbutil, and mount commands but the above should provide a brief introduction and the basics needed to test NFS and SMB shares on your networks.