File shares: NFS and SMB

What a mounted share is, NFS (exports, mounting, UID mapping, port 2049), SMB (the \\server\share name, per-user authentication, port 445), mounting from a host and its fstab line, and the effective permission.

  • 25 cards
  • 5 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. Scenarios
  5. Understand

A few cards from the deck

  • Mounting: what is it?

    Show the answer

    The operation that attaches a remote directory to a point of the local tree, so it can be used like any other folder.

    After sudo mount -t nfs srv:/srv/docs /mnt/docs, the contents of srv:/srv/docs appear under /mnt/docs. Programs read and write files without knowing they are remote.

  • Which command mounts the NFS share srv:/export/home on /mnt/home?

    • sudo mount -t nfs srv:/export/home /mnt/home
    • sudo mount -t nfs /mnt/home srv:/export/home
    • sudo mount -t cifs srv:/export/home /mnt/home
    • sudo mount -t nfs //srv/export/home /mnt/home
    Show the answer

    sudo mount -t nfs srv:/export/home /mnt/home

    mount takes the source, then the mount point. NFS names the source as server:/path; //server/share is SMB syntax, and -t cifs expects that syntax.

  • NFS (version 4) uses TCP port …; SMB uses TCP port ….

    Show the answer

    NFS (version 4) uses TCP port 2049; SMB uses TCP port 445.

    Open on the server's firewall depending on the protocol offered. An NFS mount that hangs with no clear error often comes from a closed 2049.

  • NFS: what is it?

    Show the answer

    The file-sharing protocol of Unix systems, which presents a server directory as if it were local; its port is 2049.

    The host names the share as server:/path. By default, the server trusts the numeric identity (UID, GID) the client sends it, rather than a password.

  • Files created by alice (UID 1001) from the host show up as owned by bob (UID 1001 on the server) on the NFS share. What is the cause?

    • NFS passes the numeric UID, not the name: the same number refers to two different accounts
    • The export applies root_squash, which hands created files to another account
    • The mount lost its permissions: it must be remounted with the ro option
    • The shared directory belongs to bob, and every file created in it inherits its owner
    Show the answer

    NFS passes the numeric UID, not the name: the same number refers to two different accounts

    The server does not know the name alice: it reads UID 1001 and applies its own /etc/passwd. root_squash only affects root, and a file belongs to whoever creates it, not to the folder's owner. Fix: the same UID on both machines, or a shared directory.