《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/&


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