cifs是通过Internet文件系统
CIFS是一个新提出的协议,它使程序可以访问远程Internet计算机的文件并要求此计算机提供服务。CIFS使用客户/服务器模式。客户程序请求远在服务器上的服务器程序为它提供服务。服务器获得请求并返回响应。CIFS是公共的或开放的SMN协议版本。
1、CIFS文件系统
(1)下载(cifs)
(2)客户端创建文件并写入用户名及密码(初次认证的用户名及密码)
[root@client ~]# vim /root/smbpass
[root@client ~]#
(3)第一次挂载并认证
[root@client ~]# mount -o credentials=/root/smbpass,sec=ntlmssp,multiuser //172.25.254.168/student /mnt/
[root@client ~]#
在服务段查看现在SMB用户有哪些
[root@shareserver ~]# pdbedit -L
student:1000:Student User
westos:1001:
挂载完成后进入挂载目录此时用户的身份是westos
[root@client mnt]# touch file2
[root@client mnt]# ls -l file2
-rw-r–r-- 1 1001 1001 0 Nov 24 02:27 file2
[root@client mnt]#
(4)在客户段将用户切换到student进入挂载目录(/mnt)查看发现查看不了,是因为student用户没有通过认证
认证
[student@client ~]$ cifscreds add -u student 172.25.254.168
Password:
[student@client ~]$ cd /mnt
[root@client ~]# cd /mnt
[root@client mnt]# ls
file file1 file2 file3 file4
[root@client mnt]# touch file5
[root@client mnt]# ls -l file5
-rw-r–r-- 1 1001 1001 0 Nov 24 03:26 file5
2、 NFS挂载
NFS服务器可以允许NFS客户端将远端NFS服务器的共享目录挂载到本地的NFS客户端中。
1、服务端下载
服务端下载NFS服务
[root@shareserver ~]# yum install nfs-utils
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Package 1:nfs-utils-1.3.0-0.21.el7.x86_64 already installed and latest version
Nothing to do
[root@shareserver ~]# systemctl start nfs-server
设置所有用户都可以查看共享的student目录,访问方式为只读访问
[root@shareserver ~]# vim /etc/exports
配置文件写好后不能重启服务,需使用exportfs -rv命令更新配置重新读取/etc/exports内容并显示共享的详细情况