* auto-discovery of exports?
@ 2004-04-07 8:03 Michael
0 siblings, 0 replies; 11+ messages in thread
From: Michael @ 2004-04-07 8:03 UTC (permalink / raw)
To: nfs
Windows with the SFU add-on, allowing it to work as an NFS client,
manages to scan my network for NFS servers and then show the exported
filesystem under each of those servers. How could I implement the same
thing in Linux?
I ask because I want to write a program that autoscans my network for
certain files (images, music, video) that are readable and displays them
in a nice viewer to the user without needing to go searching for them. I
want the system to be flexible enough that it can allow machines to be
plugged in and out of the network and still detect those shared files
when available without any effort by the user.
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: auto-discovery of exports?
@ 2004-04-07 23:01 Guolin Cheng
2004-04-08 0:37 ` Ian Kent
2004-04-08 10:29 ` Michael
0 siblings, 2 replies; 11+ messages in thread
From: Guolin Cheng @ 2004-04-07 23:01 UTC (permalink / raw)
To: Michael, nfs
Hi, Michael,
Run shell command "showmount -e|--exports <server_to_be_questioned>".
If you would like to scan your network to check each host, run a for
loop, and in the loop put another command "rpcinfo -p
<server_to_be_questions> |grep nfs" to make sure whether the nfs server
is running on the host, if so, run the showmount command to query the
exported file system from the host.=20
Read manuals you will get more options, although the above should be
enough for your purposes.
--Guolin Cheng
-----Original Message-----
From: Michael [mailto:mogmios@mlug.missouri.edu]=20
Sent: Wednesday, April 07, 2004 1:04 AM
To: nfs@lists.sourceforge.net
Subject: [NFS] auto-discovery of exports?
Windows with the SFU add-on, allowing it to work as an NFS client,=20
manages to scan my network for NFS servers and then show the exported=20
filesystem under each of those servers. How could I implement the same=20
thing in Linux?
I ask because I want to write a program that autoscans my network for=20
certain files (images, music, video) that are readable and displays them
in a nice viewer to the user without needing to go searching for them. I
want the system to be flexible enough that it can allow machines to be=20
plugged in and out of the network and still detect those shared files=20
when available without any effort by the user.
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli=
ck
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: auto-discovery of exports?
2004-04-07 23:01 Guolin Cheng
@ 2004-04-08 0:37 ` Ian Kent
2004-04-08 5:34 ` Bryan O'Sullivan
2004-04-08 10:29 ` Michael
1 sibling, 1 reply; 11+ messages in thread
From: Ian Kent @ 2004-04-08 0:37 UTC (permalink / raw)
To: Guolin Cheng; +Cc: Michael, nfs
On Wed, 7 Apr 2004, Guolin Cheng wrote:
> Hi, Michael,
>
> Run shell command "showmount -e|--exports <server_to_be_questioned>".
> If you would like to scan your network to check each host, run a for
> loop, and in the loop put another command "rpcinfo -p
> <server_to_be_questions> |grep nfs" to make sure whether the nfs server
> is running on the host, if so, run the showmount command to query the
> exported file system from the host.
Fine but how would you enumerate the hosts?
Would you restrict this to the local subnet?
Ian
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: auto-discovery of exports?
@ 2004-04-08 1:44 Guolin Cheng
2004-04-08 2:02 ` Greg Banks
0 siblings, 1 reply; 11+ messages in thread
From: Guolin Cheng @ 2004-04-08 1:44 UTC (permalink / raw)
To: Ian Kent; +Cc: Michael, nfs
Sure, to your own networks, do you want to search all Internet for nfs
servers? :)
Run a "nmap -sU -p 2049 <your_net_work, like 192.168.0>" to find all nfs
servers providing services on UDP, similar "nmap -p 2049 <your_net_work,
like 192.168.0>" to find nfs servers on TCP.
Then for each above hosts, run the showmount command. All these can be
rolled in a simple loop with a if statement.
Thanks.
--Guolin Cheng
-----Original Message-----
From: Ian Kent [mailto:raven@themaw.net]=20
Sent: Wednesday, April 07, 2004 5:37 PM
To: Guolin Cheng
Cc: Michael; nfs@lists.sourceforge.net
Subject: RE: [NFS] auto-discovery of exports?
On Wed, 7 Apr 2004, Guolin Cheng wrote:
> Hi, Michael,
>=20
> Run shell command "showmount -e|--exports <server_to_be_questioned>".
> If you would like to scan your network to check each host, run a for
> loop, and in the loop put another command "rpcinfo -p
> <server_to_be_questions> |grep nfs" to make sure whether the nfs
server
> is running on the host, if so, run the showmount command to query the
> exported file system from the host.=20
Fine but how would you enumerate the hosts?
Would you restrict this to the local subnet?
Ian
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: auto-discovery of exports?
2004-04-08 1:44 auto-discovery of exports? Guolin Cheng
@ 2004-04-08 2:02 ` Greg Banks
2004-04-08 6:54 ` Olaf Kirch
0 siblings, 1 reply; 11+ messages in thread
From: Greg Banks @ 2004-04-08 2:02 UTC (permalink / raw)
To: Guolin Cheng; +Cc: Ian Kent, Michael, nfs
Guolin Cheng wrote:
>
> Sure, to your own networks, do you want to search all Internet for nfs
> servers? :)
>
> Run a "nmap -sU -p 2049 <your_net_work, like 192.168.0>" to find all nfs
> servers providing services on UDP, similar "nmap -p 2049 <your_net_work,
> like 192.168.0>" to find nfs servers on TCP.
You shouldn't rely on port 2049 for pre-v4 NFS. To enumerate NFS servers
try doing a broadcast RPC of a NULL call to RPC program 100003.
Greg.
--
Greg Banks, R&D Software Engineer, SGI Australian Software Group.
I don't speak for SGI.
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: auto-discovery of exports?
2004-04-08 0:37 ` Ian Kent
@ 2004-04-08 5:34 ` Bryan O'Sullivan
0 siblings, 0 replies; 11+ messages in thread
From: Bryan O'Sullivan @ 2004-04-08 5:34 UTC (permalink / raw)
To: Ian Kent; +Cc: Guolin Cheng, Michael, nfs
On Wed, 2004-04-07 at 17:37, Ian Kent wrote:
> Fine but how would you enumerate the hosts?
nmap -sR
<b
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: auto-discovery of exports?
2004-04-08 2:02 ` Greg Banks
@ 2004-04-08 6:54 ` Olaf Kirch
2004-04-08 7:07 ` Greg Banks
0 siblings, 1 reply; 11+ messages in thread
From: Olaf Kirch @ 2004-04-08 6:54 UTC (permalink / raw)
To: Greg Banks; +Cc: Guolin Cheng, Ian Kent, Michael, nfs
On Thu, Apr 08, 2004 at 12:02:37PM +1000, Greg Banks wrote:
> You shouldn't rely on port 2049 for pre-v4 NFS. To enumerate NFS servers
> try doing a broadcast RPC of a NULL call to RPC program 100003.
No, that won't help. Many portmappers are quite restrictive in what
they forward via PMAP_CALL. NFS and MOUNT calls are not among them for
security reasons (because by bouncing your request off portmap, the NFS
server will see a request from 127.0.0.1 - and may grant you more rights
than you would get ordinarily).
Some portmaps may actually allow calls to the NFS NULL procedure, but
many don't.
Broadcasts to 2049 may not work either if the daemon binds to all interface
addresses rather than INADDR_ANY.
I wrote a tool for enumerating NFS servers a long time back, and found
the only way to go about it is to enumerate all hosts first, then do a
pmap_getport(100005), and then call each mountd i turn.
Alternatively you could set up an SLP directory, and change your nfsd startup
scripts to register all nfsd's via SLP.
Olaf
--
Olaf Kirch | The Hardware Gods hate me.
okir@suse.de |
---------------+
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: auto-discovery of exports?
2004-04-08 6:54 ` Olaf Kirch
@ 2004-04-08 7:07 ` Greg Banks
2004-04-08 8:55 ` Olaf Kirch
0 siblings, 1 reply; 11+ messages in thread
From: Greg Banks @ 2004-04-08 7:07 UTC (permalink / raw)
To: Olaf Kirch; +Cc: Guolin Cheng, Ian Kent, Michael, nfs
Olaf Kirch wrote:
>
> Some portmaps may actually allow calls to the NFS NULL procedure, but
> many don't.
The ones based on modern ONC code, like Solaris and IRIX, explicitly
allow NULL calls before doing their fancy checks based on program numbers.
I'd be interested to hear of actual counterexamples.
> I wrote a tool for enumerating NFS servers a long time back, and found
> the only way to go about it is to enumerate all hosts first, then do a
> pmap_getport(100005), and then call each mountd i turn.
Sure, a two stage approach will work: broadcast RPC to find hosts
running portmappers, then try showmount -e on each.
Greg.
--
Greg Banks, R&D Software Engineer, SGI Australian Software Group.
I don't speak for SGI.
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: auto-discovery of exports?
2004-04-08 7:07 ` Greg Banks
@ 2004-04-08 8:55 ` Olaf Kirch
2004-04-11 9:44 ` Greg Banks
0 siblings, 1 reply; 11+ messages in thread
From: Olaf Kirch @ 2004-04-08 8:55 UTC (permalink / raw)
To: Greg Banks; +Cc: Guolin Cheng, Ian Kent, Michael, nfs
On Thu, Apr 08, 2004 at 05:07:25PM +1000, Greg Banks wrote:
> The ones based on modern ONC code, like Solaris and IRIX, explicitly
> allow NULL calls before doing their fancy checks based on program numbers.
> I'd be interested to hear of actual counterexamples.
Wietse Venema's portmapper which I think all Linux distributors
use has this:
if (prog == PMAPPROG || prog == NFSPROG || prog == YPXPROG ||
(prog == MOUNTPROG && aproc == MOUNTPROC_MNT) ||
(prog == YPPROG && aproc != YPPROC_DOMAIN_NONACK)) {
log_no_forward(addr, proc, prog);
return (FALSE);
}
so you're right, calling the MOUNT NULL procedure via PMAP_CALL
should work. You could even broadcast a DUMP call...
Calling NFS NULL will not work, though.
Olaf
--
Olaf Kirch | The Hardware Gods hate me.
okir@suse.de |
---------------+
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: auto-discovery of exports?
2004-04-07 23:01 Guolin Cheng
2004-04-08 0:37 ` Ian Kent
@ 2004-04-08 10:29 ` Michael
1 sibling, 0 replies; 11+ messages in thread
From: Michael @ 2004-04-08 10:29 UTC (permalink / raw)
To: nfs
Thanks everyone for the input. Based on your suggestions I quickly put
together this rough shell script which seems to work. It correctly found
every nfs server on my LAN and listed the exports each had.
---------------
#!/bin/bash
PORT='111'
NETWORK='192.168.1.0/24'
NMAP='/usr/bin/nmap'
SHOWMOUNT='/usr/sbin/showmount'
IPs=`$NMAP -PT$PORT $NETWORK | grep "Interesting ports on" | cut -d" "
-f4 | cut -d":" -f1`
for IP in $IPs ; do
$SHOWMOUNT -e $IP
done
---------------
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: auto-discovery of exports?
2004-04-08 8:55 ` Olaf Kirch
@ 2004-04-11 9:44 ` Greg Banks
0 siblings, 0 replies; 11+ messages in thread
From: Greg Banks @ 2004-04-11 9:44 UTC (permalink / raw)
To: Olaf Kirch; +Cc: Greg Banks, Guolin Cheng, Ian Kent, Michael, nfs
On Thu, Apr 08, 2004 at 10:55:57AM +0200, Olaf Kirch wrote:
> [...]calling the MOUNT NULL procedure via PMAP_CALL
> should work.
Righto.
> You could even broadcast a DUMP call...
Except that the reply might blow the libc 8800 byte limit for
UDP RPC replies (I've seen this happen).
> Calling NFS NULL will not work, though.
Indeed.
So it seems an approach that would work is to a broadcast
RPC call to MOUNT NULL followed by showmount -e to each
of the repliers. Something like...
/usr/sbin/rpcinfo -b mountd 1 | while read IPADDR NAME ; do
showmount -e --no-headers $NAME | ...
done
Greg.
--
Greg Banks, R&D Software Engineer, SGI Australian Software Group.
I don't speak for SGI.
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-04-11 9:44 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-08 1:44 auto-discovery of exports? Guolin Cheng
2004-04-08 2:02 ` Greg Banks
2004-04-08 6:54 ` Olaf Kirch
2004-04-08 7:07 ` Greg Banks
2004-04-08 8:55 ` Olaf Kirch
2004-04-11 9:44 ` Greg Banks
-- strict thread matches above, loose matches on Subject: below --
2004-04-07 23:01 Guolin Cheng
2004-04-08 0:37 ` Ian Kent
2004-04-08 5:34 ` Bryan O'Sullivan
2004-04-08 10:29 ` Michael
2004-04-07 8:03 Michael
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.