Linux NFS configures no_root_squash to solve the write permission problem of the client mount point directory

[root@localhost ~]# cat /etc/exports
/home *(rw,sync,no_subtree_check,no_root_squash)
/var/www/svn *(rw,sync,no_subtree_check,no_root_squash)

insert image description here

/homeIf you want to use as a mount point on the NFS client , and /homecreate a subdirectory named under the directory , it is very important hometo ensure that you have sufficient permissions to create subdirectories under the directory./home

The problem may be that the permissions are being overridden when the NFS filesystem is mounted. To resolve permissions issues on NFS clients, you can try using the option when mounting NFS filesystems no_root_squash. no_root_squashoption ensures that when using the root user (with UID 0) on the NFS client, its permissions are not mapped to an unprivileged user on the remote NFS server. This ensures that the root user has the same permissions on the client as on the server, including /homecreating subdirectories under the directory.

/etc/fstabFor example, suppose you have the following mount configuration in your file:

172.16.3.67:/remote_home   /home   nfs   defaults 0 0

You can modify it to:

172.16.3.67:/remote_home   /home   nfs   defaults,no_root_squash 0 0

Then remount:

sudo mount -o remount /home

By adding the option, you should be able to create subdirectories under the directory no_root_squashon NFS clients without running into permission issues./homehome

But please note that enabling no_root_squashwill make the root user have the same permissions on the NFS client as on the server, which may bring some security risks. In practical applications, please carefully balance security and convenience, and make sure to select the appropriate permission configuration according to your environment.

Guess you like

Origin blog.csdn.net/a772304419/article/details/131985892