nfs服务器实现文件共享,NFS服务器及Samba服务配置实现文件共享(示例代码)
NFS服務器運行原理
實戰配置NFS服務器
配置Samba服務器及實現文件共享
(一)NFS器服務端描述
NFS服務器: Network File System,網絡文件系統使FreeBSD支持的一種
系統安裝,直接用yum方式安裝 ?# yum -y install NFS*
啟動服務 #/etc/init.d/nfs start
啟動顯示失敗:annot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad ,需要啟動rpc服務
# /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
[FAILED]
Starting NFS mountd: [FAILED]
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
rpc.nfsd: unable to set any sockets for nfsd
[FAILED]
# /etc/init.d/rpcbind start
Starting rpcbind: [ OK ]
4. 查看NFS服務啟動端口 ?# netstat -antup | grep 2049
# chkconfig nfs on
# chkconfig--list nfs
nfs0:off 1:off 2:on 3:on 4:on 5:on 6:off
5. 設置開機自啟動
6. 查看共享目錄
# showmount -e 192.168.0.35Export listfor 192.168.0.35:
7. ?設置共享目錄
編輯 #vim /etc/exports
/mysh * {rwx} ? ? ### 允許訪問的網段 ? 用戶 權限 ?,*表示所有用戶
### 多網段分開寫
8. ?重啟NFS服務,查看NFS共享,并進行掛載
# showmount -e 192.168.0.35Export listfor 192.168.0.35:/mysh *# mount -t nfs 192.168.0.35:/mysh/ /opt/# df -h
Filesystem Size Used Avail Use%Mounted on/dev/sda3 19G 5.1G 13G 29% /tmpfs 427M 72K 427M1% /dev/shm/dev/sda1 97M 34M 59M 37% /boot192.168.0.35:/mysh/ 9.5G 1.1G 8.0G 12% /opt
9. ?開機自動掛載 編輯 /etc/fstab 文件,添加即可
10.權限問題 ? 1)服務本身權限
2)目錄權限 ? ?# chmod 777 -R /mysh/
# grep nfs /etc/passwdrpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
總結
以上是生活随笔為你收集整理的nfs服务器实现文件共享,NFS服务器及Samba服务配置实现文件共享(示例代码)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: GPT-4 外逃计划曝光,斯坦福教授发现
- 下一篇: 究极绿宝石裂空座配招是什么