<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[Setting Up NFS Server And Client On CentOS 7，NFS服务器搭建链接，主要讲挂载目录的跟的uid权限和NFS的Server端有关。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Unix/LinuxC技术]]></category>
<pubDate>Tue, 16 Aug 2016 09:18:49 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	背景：想搭建一个Gitlab的两台机器进行都访问NAS网盘作为数据共享，而这样的好处是网盘内容是一致的，达到高可用，而同时对这个NAS网盘进行Git命令备份，防止网盘挂了，也能恢复，也是代码数据的高可用。<br/>在阿里云上也申请了一个类似的NFS磁盘，但是挂载时是ROOT权限，我那个/home/git/.ssh想是git权限，于是提起工单：<br/><textarea name="code" class="php" rows="15" cols="100">
 jac***@aliyun.com :&nbsp;&nbsp; 能否有办法帮我实现101.200.228.135上的NAS的挂载后是/home/xiangdong/mnt git权限且755啊？现在是Root。
——————
被挂载目录：
/home/xiangdong/mnt
Mount服务端：
1088d4bf4b-ldi58.cn-beijing.nas.aliyuncs.com

需求：
被挂载的目录是git用户，如下：
drwxr-xr-x 11 git git 114688 Jun 11 20:04 mnt/

挂载后是Root权限：
drwxrwxrwt&nbsp;&nbsp; 4 root root&nbsp;&nbsp;4096 6月&nbsp;&nbsp;15 17:12 mnt
#chown git mnt/
chown: 正在更改&quot;mnt/&quot; 的所有者: 不允许的操作~

这样：
sudo -u git -H mount -t nfs4 1088d4bf4b-ldi58.cn-beijing.nas.aliyuncs.com:/ /home/git/mnt/
mount: 只有 root 用户能使用“--types”选项

能否有办法帮我实现101.200.228.135上的NAS的挂载后是/home/xiangdong/mnt git权限且755啊？现在是Root。&nbsp;&nbsp;
</textarea><br/><br/><textarea name="code" class="php" rows="15" cols="100">
 jac***@aliyun.com :&nbsp;&nbsp; 我是指的挂载的根目录不是Git，而不是里面的目录权限：
如，我挂载前的挂载点是：
/home/xiangdong/mnt //它是git.git 755权限。
挂载命令挂载成功后：
/home/xiangdong/mnt&nbsp;&nbsp;//它变成了root 777权限。

我想要的结果是：
/home/xiangdong/mnt&nbsp;&nbsp;//与挂载前不变，还是git.git 755权限。挂载后变了。

与是我想用git用户去挂载，会提示：
sudo -u git -H mount -t nfs4 1088d4bf4b-ldi58.cn-beijing.nas.aliyuncs.com:/ /home/git/mnt/
mount: 只有 root 用户能使用“--types”选项&nbsp;&nbsp;
</textarea><br/><br/>售后工程师 :&nbsp;&nbsp;&nbsp;&nbsp;您好，这样不支持，mount后的目录权限有ans服务端决定，目前不支持修改。&nbsp;&nbsp;<br/>2017-07-06 23:42:54<br/>售后工程师 :&nbsp;&nbsp;&nbsp;&nbsp;您好，技术反馈这个是nas服务端决定的，目前我方设置的权限是777 root：root&nbsp;&nbsp;<br/><br/>经实践：<br/>mkdir -p /home/git/mnt<br/>ll&nbsp;&nbsp;-d /home/git/mnt/<br/>drwxr-xr-x 2 root root 4096 Jul&nbsp;&nbsp;8 23:52 /home/git/mnt/&nbsp;&nbsp;#Linux root用户id号是0<br/>挂载NFS:<br/>mount -t nfs -o vers=3,tcp 10.71.15.98:/Vol-01/backup /home/git/mnt<br/>ll&nbsp;&nbsp;-d /home/git/mnt/<br/>drwxr-xr-x 11 1000 1000 114688 Jun 11 20:04 /home/git/mnt/<br/>变成1000了，这个值是NFS服务端设置的，但是阿里云是0，也就不是Git账户的ID了。它是0，root用户id号是0，不敢该RootID值为非0值。<br/><br/>推测其配置如下：<br/>打开/etc/exports文件，在末尾加入：<br/>/home/kevin *(rw,sync,no_root_squash)<br/>注：nfs允许挂载的目录及权限，在文件/etc/exports中进行定义，各字段含义如下：<br/>/home/kevin：要共享的目录<br/>* ：允许所有的网段访问<br/>rw ：读写权限<br/>sync：资料同步写入内在和硬盘<br/>no_root_squash：nfs客户端共享目录使用者权限<br/><br/><br/>nfs中exports中no_root_squash的意义：<br/>no_root_squash：登入 NFS 主机使用分享目录的使用者，如果是 root 的话，那么对于这个分享的目录来说，他就具有 root 的权限！这个项目『极不安全』，不建议使用！ <br/>root_squash：在登入 NFS 主机使用分享之目录的使用者如果是 root 时，那么这个使用者的权限将被压缩成为匿名使用者，通常他的 UID 与 GID 都会变成 nobody 那个系统账号的身份。<br/><br/>增加no_root_squash可以轻松获得NFS主机共享目录读写权限.<br/><br/>showmount -e<br/>Export list for mainboard_virtualbox_docker_10_10_0_106:<br/>/backup 10.10.0.91,10.10.0.90,10.10.0.89,10.10.0.88,10.10.0.77,10.10.0.72,10.10.0.71,10.10.0.70,10.10.0.69,10.10.0.67,10.10.0.66,10.10.0.65,10.10.0.64,10.10.0.63,10.10.0.62,10.10.0.61,10.10.0.60,10.10.0.59,10.10.0.58,10.10.0.57,10.10.0.56,10.10.0.46,10.10.0.45,10.10.0.44,10.10.0.33<br/><br/>配置完需要nfs重启一下<br/>service nfs reload<br/>systemctl restart nfs<br/>=================================================================================<br/>在文章后面有讲如何搭建NFS服务器：http://jackxiang.com/post/8299/<br/><br/>NFS, stands for Network File System, is a server-client protocol used for sharing files between linux/unix to unix/linux systems. NFS enables you to mount a remote share locally. You can then directly access any of the files on that remote share.<br/><br/>Scenario<br/><br/>In this how-to, I will be using two systems which are running with CentOS 7. The same steps are applicable for RHEL and Scientific Linux 7 distributions.<br/><br/> <br/><br/>Here are mt testing nodes details.<br/><br/>NFS Server Hostname: server.unixmen.local<br/>NFS Server IP Address: 192.168.1.101/24<br/>NFS Client Hostname: client.unixmen.local<br/>NFS Client IP Address: 192.168.1.102/24<br/>Server Side Configuration<br/><br/>Install NFS packages in your Server system by using the following command:<br/><br/>yum install nfs-utils nfs-utils-lib<br/>Enable and start NFS services:<br/><br/>systemctl enable rpcbind<br/>systemctl enable nfs-server<br/>systemctl enable nfs-lock<br/>systemctl enable nfs-idmap<br/>systemctl start rpcbind<br/>systemctl start nfs-server<br/>systemctl start nfs-lock<br/>systemctl start nfs-idmap<br/>Now, let us create some shared directories in server.<br/><br/><br/>Create a shared directory named ‘/var/unixmen_share’ in server and let the client users to read and write files in that directory.<br/><br/>mkdir /var/unixmen_share <br/>chmod 777 /var/unixmen_share/<br/>Export shared directory on NFS Server:<br/><br/>Edit file /etc/exports,<br/><br/>vi /etc/exports<br/>Add the following line:<br/><br/>/var/unixmen_share/&nbsp;&nbsp;&nbsp;&nbsp; 192.168.1.0/24(rw,sync,no_root_squash,no_all_squash)<br/>where,<br/><br/>/var/unixmen_share – shared directory<br/>192.168.1.0/24 – IP address range of clients<br/>rw – Writable permission to shared folder<br/>sync – Synchronize shared directory<br/>no_root_squash – Enable root privilege<br/>no_all_squash - Enable user’s authority<br/>Restart the NFS service:<br/><br/>systemctl restart nfs-server<br/>Client Side Configuration<br/><br/>Install NFS packages in your client system by using the following command:<br/><br/>yum install nfs-utils nfs-utils-lib<br/>Enable and start NFS services:<br/><br/>systemctl enable rpcbind<br/>systemctl enable nfs-server<br/>systemctl enable nfs-lock<br/>systemctl enable nfs-idmap<br/>systemctl start rpcbind<br/>systemctl start nfs-server<br/>systemctl start nfs-lock<br/>systemctl start nfs-idmap<br/>Mount NFS shares On clients<br/><br/>Create a mount point to mount the shared folder ‘var/unixmen_share’ which we’ve created before in the server.<br/><br/>mkdir /var/nfs_share<br/>Mount the share from server to client as shown below<br/><br/>mount -t nfs 192.168.1.101:/var/unixmen_share/ /var/nfs_share/ <br/>Sample Output:<br/><br/>mount.nfs: Connection timed out<br/>Probably, it will show a connection timed out error which means that the firewall is blocking our NFS server. To access NFS shares from remote clients, we must allow the following nfs ports in the NFS server iptables/firewall.<br/><br/>From:<br/>https://www.unixmen.com/setting-nfs-server-client-centos-7/
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] Setting Up NFS Server And Client On CentOS 7，NFS服务器搭建链接，主要讲挂载目录的跟的uid权限和NFS的Server端有关。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>