Bitzu

CPSA ยท Unix network file, trust and remote access services

NFS file-level security and UID/GID trust

UID/GID manipulation, root squashing, nosuid and noexec options.

Key points

  • Classic NFS (AUTH_SYS) trusts the numeric UID and GID the client sends, so a client where someone is root, or can pick any UID, can act as any user on the share. root_squash (the default) maps UID 0 to an anonymous user; no_root_squash disables that. all_squash maps everyone. nosuid and noexec are mount options that make the kernel ignore set-uid bits and refuse to execute binaries from the mount.

Source: https://man7.org/linux/man-pages/man5/exports.5.html

Practice questions

Single choice

What does the root_squash export option do?

  1. Maps requests from UID/GID 0 to an anonymous user
  2. Maps every user's requests to an anonymous user
  3. Encrypts file contents on the share
  4. Blocks root from logging in to the NFS server
Show answer

Answer: A. Maps requests from UID/GID 0 to an anonymous user

It maps requests from UID/GID 0 to the anonymous user, so a remote root does not get root rights on the share. It does not encrypt traffic or map every user.

Select all that apply

Which mount or export options reduce the risk of abusing files on an NFS share?

  1. root_squash
  2. nosuid
  3. no_root_squash
  4. noexec
  5. rw
Show answer

Answer: A. root_squash, B. nosuid, D. noexec

root_squash stops remote root being root on the share, nosuid makes the kernel ignore set-uid/set-gid bits, and noexec blocks running binaries from the mount. rw and no_root_squash widen what a client may do.

True or false

True or false: with root_squash enabled, a client user cannot access files belonging to another non-root UID by presenting that UID.

Show answer

Answer: False

False. root_squash only remaps UID 0. With AUTH_SYS the server trusts any other UID the client sends, so a client can claim UID 1001 and read that user's files.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More CPSA topics in this module