windows设置经过NFS链接到Linux共享数据

一.搭建NFS服务

1.NFS服务搭建环境说明

NFS服务端:
IP:192.168.43.156
NFS客户端:
IP:192.168.43.185
两台服务器都关闭防火墙及SElinuxlinux

systemctl stop firewalld.service
setenforce 0

2.NFS服务端搭建步骤

2.1 yum安装NFS和RPC服务windows

yum install nfs-utils rpcbind -y

2.2 动RPC服务和NFS服务服务器

systemctl start rpcbind
systemctl start nfs
ps -ef|grep rpc
ps -ef|grep nfs
lsof -i:111
rpcinfo -p localhost

2.3 设置开机自启动并检查ide

systemctl enable rpcbind
systemctl enable nfs
systemctl list-unit-files --type=service|grep "enabled"|egrep "rpcbind|nfs"

2.4 建立共享目录3d

mkdir /data 
chown -R nfsnobody.nfsnobody /data
ls -ld /data

2.5 配置共享/data目录code

cat>>/etc/exports<<EOF
#NFS server share directories
/data 192.168.43.156(rw,sync)
EOF
cat /etc/exports

2.7 平滑重启NFS服务并检查服务server

systemctl reload nfs
cat /var/lib/nfs/etab

2.8 本地查看挂载目录blog

showmount -e 192.168.43.156

三、NFS客户端搭建步骤

3.1 安装NFS和RPC服务并检查ci

yum install nfs-utils rpcbind -y

3.2 启动RPC服务(不须要启动NFS服务,缘由是不安装NFS服务的话没有showmount这个命令)rpc

systemctl start rpcbind 
ps -ef|grep rpc
lsof -i:111

3.3 设置开机自启动并检查

systemctl enable rpcbind
systemctl list-unit-files --type=service|grep "enabled"|grep "rpcbind"

3.4 检查服务端的NFS挂载目录是否OK

showmount -e 192.168.43.156

3.5 挂载设置开机自动挂载

mount -t nfs 192.168.43.156:/data /mnt
echo "mount -t nfs 192.168.43.156:/data /mnt">>/etc/rc.local

3.6 查看是否挂载成功

df -h

二.windows设置经过NFS链接到Linux共享数据

1. 在linux下设置nfs数据共享

more /etc/exports

1.2 而后执行:

exportfs  -av

2.在win7下开启nfs功能

windows设置经过NFS链接到Linux共享数据
windows设置经过NFS链接到Linux共享数据
windows设置经过NFS链接到Linux共享数据

3.接着开始在win7进行挂载操做

mount \\192.168.43.156\data x:\

windows设置经过NFS链接到Linux共享数据
windows设置经过NFS链接到Linux共享数据

4.修改win7对nfs分区只读属性

Win7 NFS客户端使用mount命令挂载NFS服务以后,文件系统对Win7只读,没法写入文件,没法新建文件夹,此时使用mount命令能够查看到以下状态:
windows设置经过NFS链接到Linux共享数据
UID=-2在存储设备上共享出来的NFS文件系统归属于root权限,没法修改该所属用户,Windows经过UID=-2的用户去写,写不进去。

regedit(打开注册表)

让Win7在挂载NFS的时候将UID和GID改为0便可,
:打开注册表:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default,增长两项:AnonymousUid,AnonymousGid,如图:

windows设置经过NFS链接到Linux共享数据

5.重启计算机

6..在cmd内输入mount 查看属性

windows设置经过NFS链接到Linux共享数据

7.在x:盘下放置***程序

windows设置经过NFS链接到Linux共享数据

8.用电脑自带的杀毒软件进行查杀

windows设置经过NFS链接到Linux共享数据

9.查杀成功

windows设置经过NFS链接到Linux共享数据

相关文章
相关标签/搜索