Samba是服务器进行网络文件共享的一种方式。所以win7以访问共享的方式,访问samba服务器的ip便可以连接到samba,方法如下:
1、按下win7的快捷键(WIN+R)打开“运行”工具。
2、在“运行”中输入:\\samba服务器的ip\共享目录 然后回车即可连接。
samba安装和启动
samba的源码安装采用最新版本samba-4.1.14,官网下载。安装过程如下:
$ sudo mkdir /usr/local/samba-4.1.14
$ ./configure --prefix=/usr/local/samba-4.1.14
...
Checking for program xsltproc : not found
Checking for program python : /usr/bin/python
Checking for program python : /usr/bin/python
Checking for program python : /usr/bin/python
Checking for Python version >= 2.5.0 : ok 2.7.6
Checking for library python2.7 : not found
Checking for library python2.7 : yes
Checking for program python2.7-config : not found
Checking for program python-config-2.7 : not found
Checking
for custom code
: Could not find the python development headers
/home/anonymalias/Downloads/samba-4.1.14/wscript:100:
error: the configuration failed (see
'/home/anonymalias/Downloads/samba-4.1.14/bin/config.log')
上面错误的原因是samba必须依赖python,执行
$ sudo apt-get install python-dev
后面就是make &&sudo make install,安装ok后,安装目录结构如下:
/usr/local/samba-4.1.14$ ls
bin etc include lib private sbin share va
将源码文件下默认的conf文件拷贝到安装目录下的etc目录中
/usr/local/samba-4.1.14$ cp /home/anonymalias/Downloads/samba-4.1.14/examples/smb.conf.default etc/smb.conf
修改smb.conf中配置
global段添加如下字段
[global]
...
netbios name = ubuntu
共享资源字段采用默认配置
[homes]
comment = Home Directories
browseable = no
writable = yes
# NOTE: If you have a BSD-style print system there is no need to
# specifically define each individual printer
[printers]
comment = All Printers
path = /usr/spool/samba
browseable = no
# Set public = yes to allow user 'guest account' to print
guest ok = no
writable = no
printable = yes
添加用户名为Ubuntu的账户,
/usr/local/samba-4.1.14$ sudo bin/smbpasswd -a ubuntu
New SMB password:
Retype new SMB password:
samba服务器的用户是依赖于linux的用户,只能添加linux中已存在的用户,否则会出现如下错误:
/usr/local/samba-4.1.14$ sudo bin/smbpasswd -a user1
New SMB password:
Retype new SMB password:
Failed to add entry for user user1.
启动samba 服务
/usr/local/samba-4.1.14$ sudo sbin/nmbd
/usr/local/samba-4.1.14$ sudo sbin/smbd
在Windwos文件管理器或直接win+R,输入server ip,可以看到如下界面:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)