1. nfscat(8)
  2. nfscat(8)

NAME

nfscat - read a file over NFS and print to stdout

SYNOPSIS

nfscat [-hTv] [-b blocksize] [-c count] [-H hertz] [-S source]

DESCRIPTION

nfscat sends NFS version 3 READ RPC requests to an NFS server and prints the file contents in the responses to stdout. It starts at the beginning of the file and will read it until the end unless a number of requests is specified with the -c option.

The filehandles to be read are passed on stdin as a series of JSON objects (one per line) with the keys "host", "ip", "path", and "filehandle", where the value of the "filehandle" key is the hex representation of the file's NFS filehandle.

If the NFS server requires "secure" ports (<1024), nfscat will have to be run as root.

OPTIONS

-b

Set the blocksize for requests in bytes. Default is 8192.

-c

Count of requests to send for each file before exiting. Instead of printing the file contents to stdout, print a summary line for each request with the response time.

-h

Display a help message and exit.

-H hertz

The polling frequency in Hertz. This is the number of requests sent to each target per second. Default = 1.

-S source

Use the specified source IP address for request packets.

-T

Use TCP to connect to server. Default = UDP.

-v

Display debug output on stderr.

EXAMPLES

Here is a pipeline of commands which demonstrates using nfsmount to obtain the root filehandle, then using nfsls to find the filehandle for /etc/hosts and finally nfscat to print the contents:

sudo sh -c "nfsmount dumpy:/ | nfsls | grep etc | nfsls | grep hosts | nfscat"

RETURN VALUES

nfscat will return 0 if all requests to all targets received successful responses. Nonzero exit codes indicate a failure. 1 is an RPC error, 2 is a name resolution failure, 3 is an initialisation failure (typically bad arguments).

AUTHOR

Matt Provost, mprovost@termcap.net

Copyright 2017 Matt Provost
RPC files Copyright Sun Microsystems
NFSv4 files Copyright IETF

SEE ALSO

nfsmount(8), nfsls(8)

  1. January 2017
  2. nfscat(8)