大网数据广告活动
服务器运维问答

What does the NO_ALL_SQUASH option do in NFS exports?

· 52CE 我爱测

From the exports(5) man page , in the "User ID Mapping" section, it says: User ID Mapping ... Very often, it is not desirable that the root user on a client machine is also treated as root when accessing files on the NFS server. …

问题原文

原帖链接 · Siu Ching Pong -Asuka Kenji- · CC BY-SA 4.0

From the exports(5) man page, in the "User ID Mapping" section, it says:

User ID Mapping

...

Very often, it is not desirable that the root user on a client machine is also treated as root when accessing files on the NFS server. To this end, uid 0 is normally mapped to a different id: the so-called anonymous or nobody uid. This mode of operation (called `root squashing') is the default, and can be turned off with no_root_squash.

...

Here's the complete list of mapping options:

root_squashMap requests from uid/gid 0 to the anonymous uid/gid. Note that this does not apply to any other uids or gids that might be equally sensitive, such as user bin or group staff. no_root_squashTurn off root squashing. This option is mainly useful for diskless clients. all_squashMap all uids and gids to the anonymous user. Useful for NFS-exported public FTP directories, news spool directories, etc. The opposite option is no_all_squash, which is the default setting.

...

I summarized the UID mapping options in the following table (assumed 1000 to be the UID of a non-privileged user, and 65534 to be the anonymous UID):

Option Client UID Server UID
root_squash 0 65534
root_squash 1000 1000
no_root_squash 0 0
no_root_squash 1000 1000
all_squash 0 65534
all_squash 1000 65534
no_all_squash 0 0 (unsure)
no_all_squash 1000 65534 (unsure)

Question

  1. Is my summary for the no_all_squash option correct? If yes, when will it be useful?
  2. Which option is the default? The paragraph above says root_squash, while no_all_squash claims itself default in the options explanation.

Thank you in advance!

社区高分解答

原帖链接 · Siu Ching Pong -Asuka Kenji- · CC BY-SA 4.0

After setting up a pair of NFS server and client in a virtual environment, I found the following result:

Option Client UID Server UID
root_squash 0 65534
root_squash 1000 1000
no_root_squash 0 0
no_root_squash 1000 1000
all_squash 0 65534
all_squash 1000 65534
no_all_squash 0 65534
no_all_squash 1000 1000

In other words, the no_all_squash option appears to behave the same as the root_squash option. This answers Question 1 and explains Question 2 at the same time.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-01-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。