📄 1537.html
字号:
<TD><IMG height=22 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=10 cellPadding=0 width="100%" bgColor=#ffffff
border=0>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
<TR>
<TD vAlign=top align=middle width="60%">
<TABLE cellSpacing=0 cellPadding=0 width="100%"
background="images/back.gif" tppabs="http://www.linuxhero.com/docs/images/back.gif" border=0>
<TBODY>
<TR>
<TD vAlign=top width="80%">
<DIV align=center>
<FORM action="search.html" tppabs="http://www.linuxhero.com/docs/search.html" method=get>
</FORM>
<TABLE cellSpacing=0 cellPadding=0 width="95%"
border=0><TBODY>
<TR>
<TD background="images/bgi.gif" tppabs="http://www.linuxhero.com/docs/images/bgi.gif"
height=30></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=3 width="95%"
align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top>
<p><FONT class=normalfont><B><font color=blue>samba服务器的设置</font></B></FONT><BR><FONT class=smallfont color=#ff9900>2004-04-23 15:18 pm</FONT><BR><FONT class=normalfont>作者:作者<br>来自:Linux知识宝库<br>联系方式:无名<br><br>一. linux服务器向windows客户端提供文件/目录及打印机共享<br>
linux服务器上的samba运行起来以后,linux就相当于一台文件及打印服务器,向
windows和linux samba客户提供文件及打印服务。工作在共享模式或者用户模式下的两种
方法较为常见(Security=share或Security=user),其中有以下常见问题。环境:
Redhat linux 6.x<br><br>
1. 共享模式时从windows 98客户端不能从网上邻居中看到服务器,或者看到后不能点击
进入共享资源,说密码不对等等。<br>
a. 没有去掉guest account = pcguest一行前面的注释符号<br>
b. 没有创建guest帐号pcguest (#useradd pcguest即可)<br>
c. windows 98默认发送加密的口令,而/etc/smb.conf中没有enable samba加密口令。
或者也可以编辑windows 98注册表,让它发送文本口令(不被建议的)<br><br>
2. 在/etc/smb.conf中定义了完全可写共享目录,但实际操作时不能写入。<br>
a. 特别要注意的是:linux本身的文件及目录权限永远大于samba定义的权限,要让某共
享资源目录可以被写,首先要保证在linux下面该目录可以被相应的用户可写,这是前提。<br><br>
3. 在共享模式下如何对某共享目录加用户名及密码保护<br>
a. 看下面的共享资源定义例子:<br>
security = SHARE<br>
username map = /etc/smbusers<br>
log file = /var/log/samba/log.%m<br>
max log size = 50<br>
socket options = TCP_NODELAY<br>
client code page = 936<br>
os level = 40<br>
local master = yes<br>
preferred master = yes<br>
domain master = yes<br>
guest account = pcguest<br>
encrypt passwords = yes<br>
smb passwd file = /etc/smbpasswd<br><br>
[sales]<br>
comment = test folder<br>
path = /sales/training<br>
guest ok = no<br>
writable = yes<br>
valid users = @sales<br>
write list = @sales<br><br>
在上面的例子中,我们定义了security=share和samba encrypt password,共享目录
名sales不是guest用户可访问的,需要属于sales组里的用户可访问,同时也可写,当然在
linux下面要保证/sales/training目录可被组sales可写,这样以后定义你的windows logon
(不是NT域登录)的用户名为组sales里的用户名,然后在网上邻居中双击sales时会提示你
密码,该密码是你在samba服务器上定义的samba加密的口令,在上面的例子中用户名和密
码对存放在文件/etc/smbpasswd中,当然你事先要有系统用户名在/etc/passwd中。<br><br>
4. windows用户经常不能在网上邻居中浏览到samba服务器的名字。<br>
a. windows的网上邻居服务是非常不可靠的服务,它所建立的浏览列表不可靠,由众多
因素引起。<br>
b. 一种可靠的解决办法是直接用"查找"-"计算机"-打入samba服务器的主机名进行查找。
注意要确保你在windows启动时没有取消登录。<br>
c. 你也可以在DOS窗口用net use命令:如<br>
c:>net use m: sambaservernameshareresourcename<br><br>
5. 服务器端的测试配置工具<br>
a. 在配置完/etc/smb.conf后运行testparm检测配置文件中是否有相应语法错误<br>
b. 在samba服务起来后,用smbstatus报告用户使用和登录情况。<br>
c. 在更改过配置文件后,运行/etc/rc.d/init.d/smb restart重读配置文件<br><br>
二. 在linux客户机上使用linux samba服务器<br>
1. 在linux客户机上使用smbclient<br>
a. 列出计算机192.168.100.1上所有可用的共享资源:<br>
smbclient -L 192.168.100.1<br>
如果询问口令,则直接回车。<br>
也可用名字如:<br>
smbclient -L sh3<br>
若不知道sh3的IP地址,也可用<br>
smbclient -L sh3 -I 192.168.100.1<br>
b. 以某用户身份连接到samba服务器192.168.100.1上的共享资源sales<br>
smbclient //192.168.100.1/sales -U jephe<br>
提示口令后输入口令,也可把口令打在命令行上用%号分隔,为:<br>
smbclient //192.168.100.1/sales -U jephe%password<br>
提示符为smb:,就象是FTP一样<br>
也可用名字如:<br>
smbclient //sh3/sales -I 192.168.100.1 -U jephe<br>
你也可以用符号,你的SHELL可能会过滤到特殊符号,则要这样写<br>
#smbclient \sh3sales<br><br>
2. 通过IP地址查找netbios名字<br>
a. 在windows下用<br>
c:>nbtstat -A 192.168.100.1<br>
如果知道netbios名字,可用下面的命令得知某机器哪些服务<br>
c:>nbtstat -a hydra<br>
b. 在linux下用<br>
#nmblookup -A 192.168.100.1<br>
在一个网段内可用下面的命令检测哪些主机在提供samba共享服务:<br>
#nmblookup -d 2 * 或<br>
#nmblookup -B 192.168.100.255 *<br>
检测其它网段内的某台机器是否提供samba服务<br>
#nmblookup -A 192.168.15.48<br>
但不能用 #nmblookup -B 192.168.15.255 *,因为一般的路由器和linux双宿主机不
转发子网直接广播。<br><br>
3. netbios over TCP/IP使用的协议及端口号<br>
a. 共有三种netbios服务<br>
netbios-ns 137/udp(大多数) and 137/tcp<br>
netbios-dgm 138/udp(大多数)and 138/udp(<font color=red>明显有误,到底哪个是udp/tcp</font>)<br>
netbios-ssn 139/tcp<br>
b. windows机器上的PC应用程序通过不同机器间的netbios名字来彼此通讯。<br>
c. 每次当windows机器启动时,它向整个网段内发出137/udp广播,一来登记向某工作组
内的主浏览器登记netbios名字,二来确信整个子网内没有与之相同的名字<br>
d. 网上邻居中所建立起来的浏览列表仅仅是列表,看不到也没有关系,同样也可以通过
计算机查找,net use命令等来与别的计算机通讯,共享文件和打印机<br>
e. 不在同一网段内的机器或者是拨号到LAN上的PPP服务器后不可能进行网上邻居的浏览。
这是因为子网内的广播不被串行线路和路由器转发。<br>
f. 如何在拨号到LAN上的PPP服务器后使用LAN上的samba服务器<font color=red>到底如何操作,不能理解</font><br>
<1> 在windows目录下编辑c:windowslmhosts<br>
如:192.168.11.3 sh3 #PRE #DOM:sales<br>
执行nbtstat -R 去enable它,不需要重启windows<br>
<2> 你必须登录windows,若是用户模式的samba,你应该选择windows NT登录<br>
<3> 其它设置跟LAN上的机器一样<br>
<4> 拨号建立连接后,在查找"计算机"功能定位资源<br>
<5> 现在你能使用远端服务器上的目录和打印机。<br>
在不同网段内的机器也可参照此做法,也可用plug-gw代理tcp/139号端口访问另一网段
上的samba服务器。<br><br>
4. 用Microsoft FTP服务器的简便方法。 ftp.microsoft.com<font color=red>到底是什么意思,不能理解</font><br>
a. 加ftp到lmhosts文件<br>
198.105.232.1 ftp #PRE<br>
运行nbtstat -R<br>
b. net view ftp<br>
c. net use g: ftpdata<br>
d. dir g:<br><br>
5. smbmount的使用<br>
a. #smbmount //192.168.100.1/pub /mnt/sh3 -o username=jephe%password<br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -