NFS配置項no_root_squash和root_squash的區別


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 那個系統賬號的身份。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM