1.网络文件共享服务:
网络文件共享服务是一个服务器为多个客户端提供操作网络文件的服务,它包括了Linux对windows,linux对linux,和windows对linux。
2.CIFS:通用网络文件系统,是由sun公司和微软公司共同开发,主要针对WINDOWS操作系统的本地网络文件系统。它是对网络文件系统的共享,不同于ftp是对于网络文件权限的共享。
3.需要下载服务客户端:yum install samba-client -y
4. [root@localhost mnt]# smbclient -L //172.25.254.250 ##列出已分享的文件系统 Enter root's password: Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1] Sharename Type Comment --------- ---- ------- westos1 Disk test share westos2 Disk test share westos3 Disk test share westos4 Disk test share westos5 Disk test share westos6 Disk test share westos7 Disk test share westos8 Disk test share westos9 Disk test share westos10 Disk test share IPC$ IPC IPC Service (Samba Server Version 4.1.1) Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1] Server Comment --------- ------- Workgroup Master --------- -------
5.进入服务器的westos1目录
[root@localhost mnt]# smbclient //172.25.254.250/westos1 Enter root's password: ###不需要密码直接回车 Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1] smb: \> ls . D 0 Sun Apr 30 01:35:25 2017 .. D 0 Wed Dec 2 20:43:01 2015 file1 A 0 Sun Apr 30 01:34:47 2017 anaconda-ks.cfg A 8619 Sun Apr 30 01:35:06 2017 file A 52 Sun Apr 30 01:35:24 2017 userfile A 19 Sun Apr 30 01:35:25 2017 100221120 blocks of size 1024. 21822928 blocks available smb: \> [root@localhost mnt]# ls creat_user.sh file userfile [root@localhost mnt]# cd [root@localhost ~]# ls ##显示当前位置的内容 anaconda-ks.cfg Documents Music Public Videos Desktop Downloads Pictures Templates
6.设置开机自动挂载
[root@localhost ~]# vim /etc/fstab //172.25.254.250/westos1 /mnt cifs defaults,username=guest 0 0 [root@localhost ~]# mount -a [root@localhost ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/vda1 10473900 3809252 6664648 37% / devtmpfs 927072 0 927072 0% /dev tmpfs 942660 140 942520 1% /dev/shm tmpfs 942660 17032 925628 2% /run tmpfs 942660 0 942660 0% /sys/fs/cgroup /dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64 //172.25.254.250/westos1 100221120 78407756 21813364 79% /mnt
7.nfs网络文件共享协议,安装访问共享软件:
yum install nfs-utils -y
8.识别共享:[root@localhost ~]# showmount -e 172.25.254.250 ##显示已识别的文件系统 Export list for 172.25.254.250: /nfsshare/nfs5 * /nfsshare/nfs4 * /nfsshare/nfs3 * /nfsshare/nfs2 * /nfsshare/nfs1 * /content 172.25.0.0/255.255.0.0
9.使用共享:
[root@localhost ~]# mount 172.25.254.250:/nfsshare/nfs1 /mnt ##挂载文件系统 [root@localhost ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/vda1 10473900 3810252 6663648 37% / devtmpfs 927072 0 927072 0% /dev tmpfs 942660 140 942520 1% /dev/shm tmpfs 942660 17036 925624 2% /run tmpfs 942660 0 942660 0% /sys/fs/cgroup /dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64 172.25.254.250:/nfsshare/nfs1 100221952 78403584 21818368 79% /mnt [root@localhost ~]# cd /mnt [root@localhost mnt]# touch file
[root@localhost mnt]# cd [root@localhost ~]# umount /mnt