《Linux菜鸟入门2》访问网络文件系统




1.cifs网络文件系统访问

1.安装共享访问客户端

yum install samba-client -y

2.识别共享服务器共享目录

smbclient -L //172.25.254.253

 

3.访问共享

直接用命令访问

smbclient //..... -o username=guest

挂载访问

4.开机自动挂载

   方法1  vim /etc/fstab

//172.25.254.254/westos /mnt cifs default,username=guest

   方法2  vim /etc/rc.d/rc.local

            mount

2.nfs网络文件系统的共享


1.安装共享访问客户端

yum install nfs-utils -y

2.识别共享

showmount -e IP

3.使用共享

mount 172.25.254.250/nfsshare/nfs /mnt

4.自动挂载

 

方法1  vim /etc/fstab

172.25.254.250:/nfsshare/nfs1 /mnt nfs defaults 0

方法2  vim /etc/rc.d/rc.local

mount 172.25.254.250:/nfsshare/nfs1 /mnt

chmod 755 /etc/rc.d/rc.local

 

 

3. autofs 自动挂载服务

1.服务功能

默认使用mount挂载共享时在挂载,不使用共享也会处于挂载状态。浪费共享服务器资源

autofs实现使用时自动挂载,闲置时自动卸载

 

2.安装服务

yum install autofs -y

systemcrl start autofs


3.访问

cd /net/172.25.254.250/nfsshare/nfs1


4.设定空闲卸载时间

vim /etc/autofs.conf

timeout =3             闲置3秒系统自动卸载网络设备

 

5.实现自定义共享挂载点

vim /etc/auto.master

最终自定义挂载点的上层目录     子配置文件

/mnt   /etc/auto.nfs


vim 子配置文件

最终挂载点           网络共享目录

vim /etc/auto.nfs(名字自定义,注意和master文件内的文件名称保持一致)

pub1       172.25.254.250:/nfsshare/nfs1

*   172.25.254.250:/nfsshare/&


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章