1, linux --> linux : samba,nfs
samba局域网内挂载: 指定uid,gid(否则只有root对目录有读写权限)数据源src
目标端destlinux服务机共享一个目录为NFS
linux客户机挂载该目录为本地目录(预先创建好目录)
安装samba软件,配置访问用户密码
sudo mount -t cifs -o username=test2,password=test2,auto,dir_mode=077,file_mode=0777,rw,vers=1.0,uid=500,gid=500 //192.168.56.13/data2 /home/wang/smb/nfs公网/局域网挂载数据源src
目标端destlinux服务端安装nfs-utils,rpcbind
linux客户端mount -t nfs 192.168.56.13:/data /nfs -o rw
centos6安装nfs
yum -y install nfs-utils rpcbind
service rpcbind start; chkconfig rpcbind on
service nfs start; chkconfig nfs on
#1,配置共享目录及权限
mkdir /data
cat > /etc/exports <
/data *(rw,sync,no_root_squash)
EOF
#2, 重新加载配置
service nfs reload
#3,查看nfs暴露的目录
#[root@docker ~]# showmount --exports
#Export list for docker:
#/data *
#4,开放端口
iptables -I INPUT -p tcp --dport 2049 -j ACCEPT
#查看服务占用的端口
#[root@eadage ~]# cat /etc/services |grep nfs
#nfs 2049/tcp nfsd shilp # Network File System
#nfs 2049/udp nfsd shilp # Network File System
#nfs 2049/sctp nfsd shilp # Network File System
2, linux --> windows
数据源src
目标端destlinux共享一个目录为NFS
windows在文件管理器中访问ip共享目录
安装samba软件,配置访问用户密码
输入用户名密码登陆,映射网络驱动(盘符名)
centos6安装samba,配置访问用户名密码
yum -y install samba samba-client
service iptables stop; chkconfig iptables off
setenfoce 0; sed -i s/SELINUX=enforcing/SELINUX=disable/ /etc/selinux/config
#1, 配置访问用户密码
#使用pdbedit添加访问用户 -t, --password-from-stdin
useradd -M -s /bin/nologin test
echo -e 'testntest' |pdbedit -au test -t
#2, 配置访问用户
cat >>/etc/samba/smb.conf<
[data]
comment = public
path = /data
valid users = @test @root
browseable = yes
public = yes
writeable = yes
EOF
#3, 验证配置是否正确,重启samba
testparm -s
service smb restart
#4, 客户端验证
#[root@test ~]# smbclient -L localhost -U test%test
[root@test ~]# smbclient -L localhost -U test
Enter wang's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.23-52.el6_10]
Sharename Type Comment
--------- ---- -------
data Disk public
IPC$ IPC IPC Service (Samba Server Version 3.6.23-52.el6_10)
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.23-52.el6_10]
Server Comment
--------- -------
Workgroup Master
--------- -------
windows映射网络驱动(选择记住密码,开机自动连接)
3, windows --> linux
数据源src
目标端destwindows共享一个目录为NFS
linux mount 该目录为本地目录 (需要预先创建好)
新建目录–>右键(属性) -->共享–>高级共享:共享此文件夹,添加授权用户
sudo mount -t cifs -o username=wang,password=wang,file_mode=0777,dir_mode=077 //192.168.56.8/win2linux /home/wang/windowslinux开机自动挂在共享目录: 编辑/etc/fstab文件, 追加以下内容//192.168.56.8/win2linux /home/wang/windows cifs defaults,auto,username=wang,password=wang,file_mode=0755,dir_mode=0755