We are implementing a web front end to manage NFS and CIFS shared folders. One part displays the available share points (exports) available from any arbitrary IP address.
The backend uses smbclient -L <ip> -U <user>
to query SMB/CIFS shares and uses showmount -e <ip>
to query NFS shares.
However, showmount
hangs if target server is running any kind of firewall (doesn't matter Windows, Mac, or Linux). (These SE/SU posts here and here mention that NFS has issues with firewalls)
We tested show mount to both existing and non-existing machines. Testing several combinations of showmount -e <ip>
:
Machine NFSD Firewall Result
Exists Stopped Off clnt_create: RPC: Unable to receive
Exists Stopped On HANGS
Exists Running On HANGS
Exists Running Off returns list of exports
None n/a n/a clnt_create: RPC: Unable to receive
When showmount
hangs, it can only be killed by SIGKILL
(-9). We tried using timeout
to give up after a time period but it also hangs.
Running strace
from another terminal shows it gets stuck on connect
$ strace -p 63552
strace: Process 63552 attached
connect(4, {sa_family=AF_INET, sin_port=htons(111), sin_addr=inet_addr("192.168.2.10")}, 16
Question In this scenario, how can we use showmount
without it hanging?
One idea is to write a program to first try open a connection to the NFS IP:port and, if successful, then run showmount
. But is there any other way?
Backend running on Centos 8.