Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

showmount

Show the exports of an NFS server (and which clients mounted them).

Level
RHCSA exam
Group
Disks and file systems
Needs root
No
Package
nfs-utils

What it does

showmount -e SERVER asks the server's mountd for its export list: the folders and who may mount them. It uses the NFSv3 mount protocol, so the server firewall must allow mountd and rpc-bind. With pure NFSv4 you can instead mount the server root (mount server:/ /mnt) and look.

How to write it

showmount [OPTION]... [HOST]

Options 6

Most used

-e, --exports
Show the export list.
-a, --all
Show client host and mounted folder pairs.
-d, --directories
Show only the folders mounted by clients.
--no-headers
No header line.
-h, --help
Show help.
-v, --version
Show the version.

Examples 10

$ run as a normal user# run as root (or with sudo)

  1. 1List the exports of a server

    showmount -e server2
    Export list for server2:
    /exports/home 192.168.122.0/24
    /exports/data 192.168.122.0/24

    Folder and allowed clients.

  2. 2Local server

    showmount -e localhost

    Check your own exports.

  3. 3Firewall blocks it

    showmount -e server2
    clnt_create: RPC: Unable to receive

    Open mountd and rpc-bind on the server: firewall-cmd --add-service={mountd,rpc-bind} --permanent.

  4. 4Without showmount (NFSv4)

    mount server2:/ /mnt; ls /mnt

    The pseudo root shows the exports.

  5. 5Clients that mounted shares

    showmount -a

    On the server (NFSv3 information only).

  6. 6Only folders

    showmount -d

    Folders in use.

  7. 7For a script

    showmount -e --no-headers server2 | awk '{print $1}'

    Only the paths.

  8. 8Check before an fstab entry

    showmount -e server2 | grep -w /exports/data

    The path must match exactly.

  9. 9Find open NFS exports in your network (security)

    for h in server1 server2; do showmount -e $h 2>/dev/null; done

    Exports to * (everyone) are a data leak risk.

  10. 10Check allowed client networks

    showmount -e server2 | grep '\*'

    Exports for any host.

Exit codes

0 :: Done. 1 :: Error.