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即可。