使用samba
一、創(chuàng)建共享文件夾
1、安裝samba
sudo apt install samba
2、修改需要共享的文件夾權(quán)限
chmod 777 /home/share
3、編輯 /etc/samba/smb.conf ,在末尾增加配置
[share]
path=/home/share
available=yes
browseable=yes
writable=yes
參數(shù)說(shuō)明:
[share]為自定義共享的名稱(chēng)
path為創(chuàng)建共享的文件路徑
available用來(lái)指定該共享資源是否可用,no則不可用
browseable為設(shè)置共享是否可瀏覽,如果no就表示隱藏,需要通過(guò)IP+共享名稱(chēng)進(jìn)行訪(fǎng)問(wèn)
writable共享文件是否可寫(xiě)
4、創(chuàng)建samba賬號(hào)
在 /etc/samba/下創(chuàng)建一個(gè)名為smbpasswd的文件sudo touch /etc/samba/smbpasswd
把ubuntu已有的系統(tǒng)賬號(hào)加入到samba賬號(hào)里面smbpasswd -a test
5、重啟samba服務(wù),使配置生效
sudo service smbd restart
二、其他服務(wù)器掛載共享文件夾
1、安裝cifs-utils
sudo apt install cifs-utils
2、掛載共享文件夾
sudo mount -t cifs //<ip>/<自定義的共享文件夾名> <掛載路徑> -o username=<samba用戶(hù)名>,password=<密碼>
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-761264.html
3、卸載掛載的共享文件夾
sudo umount <掛載路徑>
文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-761264.html
使用NFS
到了這里,關(guān)于Linux/Ubuntu實(shí)現(xiàn)文件夾共享的兩種方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!