NFS配置项no_root_squash和root_squash的区别

发布时间:2020-05-11 10:57:42 阅读:960次

https://www.cnblogs.com/sevck/p/5733713.html

1、鸟哥的私房菜简体中文 http://linux-vbird.hillwood.cn/linux_server/0330nfs.htm
鸟哥的私房菜繁体中文 http://linux.vbird.org/linux_server/0330nfs.php
2、http://www.l-penguin.idv.tw/article/nfs-automount.htm
3、http://man.ddvip.com/linux/debian/nfs/nfs-conf-4.html
no_root_squash:登入 NFS 主机使用分享目录的使用者,如果是 root 的话,那么对于这个分享的目录来说,他就具有 root 的权限!这个项目『极不安全』,不建议使用!
root_squash:在登入 NFS 主机使用分享之目录的使用者如果是 root 时,那么这个使用者的权限将被压缩成为匿名使用者,通常他的 UID 与 GID 都会变成 nobody 那个系统账号的身份;
IT168:http://server.it168.com/a2008/1016/208/000000208085_1.shtml
(3)no_root_squash:当登录NFS主机使用共享目录的使用者是root时,其权限将被转换成为匿名使用者,通常它的UID与GID都会变成nobody身份。
(4)root_squash;如果登录NFS主机使用共享目录的使用者是root,那么对于这个共享的目录来说,它具有root的权限。
哈哈.........
两种截然不同的答案!
man exports:
root_squash
Map requests from uid/gid 0 to the anonymous uid/gid. Note that this does not apply to any other
uids that might be equally sensitive, such as user bin.
no_root_squash
Turn off root squashing. This option is mainly useful for diskless clients.
[root@iZ28wg1kditZ .ssh]# cat /etc/exports
/     *(rw,sync,root_squash)
[root@iZ28qsvv5siZ ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? 
[root@iZ28qsvv5siZ ~]# cat /root/.ssh/id_rsa.pub >>/tmp/test/root/.ssh/authorized_keys
-bash: /tmp/test/root/.ssh/authorized_keys: Permission denied
[root@iZ28qsvv5siZ ~]# 
[root@iZ28wg1kditZ .ssh]# cat /etc/exports
/     *(rw,sync,no_root_squash)
[root@iZ28qsvv5siZ root]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
49:08:ff:93:12:d8:26:32:e5:1b:b7:b5:8f:3c:17:2c root@iZ28qsvv5siZ
The key's randomart image is:
+--[ RSA 2048]----+
|    o            |
|   o = .         |
|  o = B o        |
|   o * * =       |
|    . o E o      |
|       o = .     |
|        + o      |
|         o       |
|                 |
+-----------------+
[root@iZ28qsvv5siZ root]# cd ~
[root@iZ28qsvv5siZ ~]# cat .ssh/id_rsa.pub >>/tmp/test/root/.ssh/
id_rsa       id_rsa.pub   known_hosts  
[root@iZ28qsvv5siZ ~]# cat .ssh/id_rsa.pub >>/tmp/test/root/.ssh/authorized_keys
[root@iZ28qsvv5siZ ~]# ssh root@xxx.xxx.xxx.xxx
Last login: Wed Aug  3 14:50:51 2016 from xxx.xxx.xxx.xx
Welcome to aliyun Elastic Compute Service!
[root@iZ28wg1kditZ ~]# ls
axel-2.4-1.el5.rf.x86_64.rpm  ghost                         __MACOSX
看来正确的应该是:
no_root_squash:登入 NFS 主机使用分享目录的使用者,如果是 root 的话,那么对于这个分享的目录来说,他就具有 root 的权限!这个项目『极不安全』,不建议使用!
root_squash:在登入 NFS 主机使用分享之目录的使用者如果是 root 时,那么这个使用者的权限将被压缩成为匿名使用者,通常他的 UID 与 GID 都会变成 nobody 那个系统账号的身份。

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询

转载请注明:NFS配置项no_root_squash和root_squash的区别 出自老鄢博客 | 欢迎分享