Linux下访问网络文件系统

访问网络文件系统
.cifs
yum install samba-client -y ##
安装客户端软件
smbclient -L //ip       ##
确定访问地址
访问方式1  
smbclient  //ip/sharename
[root@netfsclient mnt]# smbclient //172.25.254.253/westos
Enter root's password:
Domain=[USER-20161030DE] OS=[Windows 5.1] Server=[Windows 2000 LANManager]
smb: \>
[root@localhost ~]# smbclient //172.25.254.250/westos1
Enter root's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]
smb: \> !ls
anaconda-ks.cfg
smb: \> ls
  .                                   D        0 Thu Apr 13 11:34:37 2017
  ..                                  D        0 Thu Dec  3 09:43:01 2015
  file1                               N        0 Thu Apr 13 11:34:36 2017
  file2                               N        0 Thu Apr 13 11:34:36 2017
  file3                               N        0 Thu Apr 13 11:34:36 2017
  file4                               N        0 Thu Apr 13 11:34:36 2017
  file5                               N        0 Thu Apr 13 11:34:36 2017
  file6                               N        0 Thu Apr 13 11:34:36 2017
  file7                               N        0 Thu Apr 13 11:34:36 2017
  file8                               N        0 Thu Apr 13 11:34:36 2017
  file9                               N        0 Thu Apr 13 11:34:36 2017
  file10                              N        0 Thu Apr 13 11:34:36 2017
  file11                              N        0 Thu Apr 13 11:34:36 2017
  file12                              N        0 Thu Apr 13 11:34:36 2017
  file13                              N        0 Thu Apr 13 11:34:36 2017
  file14                              N        0 Thu Apr 13 11:34:36 2017
  file15                              N        0 Thu Apr 13 11:34:36 2017
  file16                              N        0 Thu Apr 13 11:34:36 2017
  file17                              N        0 Thu Apr 13 11:34:36 2017
  file18                              N        0 Thu Apr 13 11:34:36 2017
  file19                              N        0 Thu Apr 13 11:34:36 2017
  file20                              N        0 Thu Apr 13 11:34:36 2017

        48936 blocks of size 2097152.14626 blocks available

访问方式2  
mount //ip/sharename /mountpoint -o username=guest
vim /etc/fstab
#####
//ip/sharename /mountpoint cifs  defaults
username=guest 0 0
#####
mount //172.25.254.253/westos /mnt -o username=guest
开机自动挂载cifs
方法1
vim /etc/fstab
//172.25.254.253/westos /mnt    cifs    defaults,username=guest 0 0
方法2
vim /etc/rc.d/rc.local
mount //172.25.254.253/westos /mnt -o username=guest
.nfs
访问1--手动挂载方式
yum install nfs-client      ##
安装客户端软件
showmount -e ip         ##
显示访问地址下共享的目录
mount ip://sharename /mountpoint##
临时挂载
vim /etc/fstab          ##
开机自动激活挂载
######
ip://sharename /mountpoint nfs defaults 0 0
[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
[root@localhost ~]# mount 172.25.254.250:/nfsshare/nfs1 /mnt
[root@localhost ~]# cd /mnt
[root@localhost mnt]# ls
file1  file2  file3 file4  file5
[root@localhost mnt]# rm -rf file1
[root@localhost mnt]# ls
file2  file3  file4 file5
[root@localhost mnt]#
######
访问2--自动挂载方式
yum install autofs      ##
安装自动卸载软件
systemctl start autofs      ##
启动服务
cd /net/ip          ##
进入共享目录
vim /etc/sysconfig/autofs   ##
配置自动卸载时间 
######     
TIMEOUT=3
######
如何访问3--自定义挂载方式
vim /etc/auto.master        ##
主策略文件的策略编辑
#####
最终挂载点的上层目录  子策略文件
#####
vim
子策略文件          ##子策略文件的策略编辑
#####
最终挂载点  网络挂载资源
#####
systemctl restart autofs        ##
重启服务,使生效
/mnt    /etc/auto.westos
[root@localhost nfs1]# cat /etc/auto.westos
*          172.25.254.250:/nfsshare/&

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值