1.安裝samba服務
sudo apt-get install samba
遇到錯誤:
sudo apt-get install samba
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
samba : Depends: samba-common (= 2:4.1.6+dfsg-1ubuntu2.14.04.7) but 2:4.1.6+dfsg-1ubuntu2.14.04.8 is to be installed
Depends: samba-common-bin (= 2:4.1.6+dfsg-1ubuntu2.14.04.7) but 2:4.1.6+dfsg-1ubuntu2.14.04.8 is to be installed
Depends: samba-dsdb-modules but it is not going to be installed
Depends: samba-libs (= 2:4.1.6+dfsg-1ubuntu2.14.04.7) but 2:4.1.6+dfsg-1ubuntu2.14.04.8 is to be installed
Recommends: attr
Recommends: samba-vfs-modules but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
不匹配導致的問題。samba-vfs-modules 沒有正確安轉,原因是依賴的庫的版本是samba-libs (= 2:4.1.6+dfsg-1ubuntu2.14.04.7),而將要安裝的版本是 2:4.1.6+dfsg-1ubuntu2.14.04.8,因此需要刪除掉這些依賴的,重新進行安裝。
sudo apt-get autoremove samba-libs
然后再重新安裝:
sudo apt-get install samba-libs
Get:1 http://security.ubuntu.com/ubuntu/ trusty-security/main samba-libs amd64 2:4.1.6+dfsg-1ubuntu2.14.04.7 [4,093 kB]
sudo apt-get install samba-vfs-modules
sudo apt-get install samba
sudo apt-get install samba-common
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
配置samba:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak vim /etc/samba/smb.conf [share] path = /home/xxx/samba_share available = yes browseable = yes public = yes writable = yes #重啟smba服務 sudo service samba restart #sudo service smbd restart
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3.windows下訪問連接
首先確保能ping通。然后運行\\ip即可。