📄 1530.html
字号:
<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>作者:nobody_am<br>来自:Linux知识宝库<br>联系方式:无名<br><br>前言:在windows和linux的混合网络中,samba还是有很大用处的,本文用实验的方法快
速学习Samba。<br>
[实验项目]<br>
①在linux上建立Samba服务器,用类似FTP的客户端smbclient访问。<br>
②在linux上建立security=user的Samba服务器,用win2000的客户端访问。<br>
③在linux上建立security=share的samba服务器,用win2000的客户端访问。<br>
④在linux上挂载samba共享。<br>
<br>
实验一:在linux上建立Samba服务器,用类似FTP的客户端smbclient访问。<br>
[实验要求]<br>
1.两台RH8.0的机器可以互相ping通。<br>
2.机器1的IP:192.168.0.1<br>
3.机器2的IP:192.168.0.2<br>
[实验步骤]<br>
1.关掉两台机的防火墙。<br>
#service iptables stop<br>
#chkconfig iptables off<br>
2.在两台机上安装软件包。<br>
检查samba,samba-common,samba-client包是否已安装。<br>
# rpm -q samba<br>
# rpm -q samba-common<br>
# rpm -q samba-client<br>
根据结果,在安装光盘里找到没有安装的软件包,进行安装。<br>
# rpm -ivh samba*.rpm<br>
3.在机器1开启smb服务,并查看共享了什么内容。<br>
# service smb start<br>
# smbclient -L 192.168.0.1 -N<br>
4.在机器1添加新用户。<br>
# useradd user1<br>
# passwd user1<br>
密码:user1<br>
# touch /home/user1/iAmUser1<br>
5.在机器1创建smb帐户文件文件:/etc/samba/smbpasswd<br>
# touch /etc/samba/smbpasswd<br>
# smbpasswd -a user1<br>
密码:user1<br>
6.在机器1备份原配置文件:/etc/samba/smb.conf<br>
# service smb restart<br>
10.在机器2上看机器1的samba共享了什么?<br>
# smbclient -L 192.168.0.1 -N<br>
11.在机器2访问机器1的samba服务。<br>
# smbclient //192.68.0.1/homes -U user1%user1<br>
12.在机器2上成功访问后,用help查看命令。<br>
smb: >help<br>
注意:1) 用ls 看到文件iAmUser1吗?<br>
2) 比较和FTP的命令有何不同。<br>
<br>
实验二:在linux上建立security=user的Samba服务器,用win2000的客户端访问。<br>
[实验要求]<br>
1.一台RH8.0机,一台Win2k机,互相能ping通。<br>
2.RH8.0机,IP:192.168.0.1<br>
3.Win2k机,IP:192.168.0.2<br>
[实验步骤]<br>
1.在实验一的基础上,修改/etc/samba/smb.conf<br>
修改[global]段中:<br>
workgroup = WORKGROUP1<br>
----------------------------------------------------------------------<br>
如果你对上述修改熟悉,跳过这段。<br>
workgroup = WORKGROUP1为使linux和windows机在同一个工作组。<br>
----------------------------------------------------------------------<br>
注意:修改了smb.conf,必须运行:service smb restart<br>
2.修改Win2k的工作组,为WORKGROUP1,若为域控制器,必须降为普通工作组,用
Administrator重启登录。<br>
修改方法:“我的电脑”|“属性”|“网络标识”|“属性”<br>
3.在win2k机上,“网络邻居”|“整个网络”|“全部内容”|“microsoft windows 网络”
| “Workgroup1”,看到RH系统的机器了吗?<br>
4.输入用户名user1,密码user1进入,可以新建,删除文件吗?<br>
<br>
实验三:在linux上建立security=share的samba服务器,用win2000的客户端访问。<br>
[实验要求]<br>
1.一台RH8.0机,一台Win2k机,互相能ping通。<br>
2.RH8.0机,IP:192.168.0.1<br>
3.Win2k机,IP:192.168.0.2<br>
[实验步骤]<br>
1.在实验二的基础上,修改/etc/samba/smb.conf<br>
追加下面内容:<br>
[public]<br>
comment = public<br>
path = /mnt<br>
browsable = yes<br>
public =yes<br>
修改[global]段中:<br>
security = share<br>
----------------------------------------------------------------------<br>
如果你对上述修改熟悉,跳过这段。<br>
[public]定义了另一段,也可以为其他名称。<br>
path指出共享的目录。<br>
security采用share。<br>
----------------------------------------------------------------------<br>
注意:修改了smb.conf,必须运行:service smb restart<br>
2.在win2k机上,用Administrator登录,“网络邻居”|“整个网络”|“全部内容”|
“microsoft windows 网络”| “Workgroup1”,看到RH系统的机器了吗?<br>
3.不用密码就可以进入了,是吗?你看到几个共享目录?可以写入吗?<br>
4.在win2k机上新建一个帐户:user1,密码:user1。<br>
5.在win2k机上注销,切换用户user1。<br>
6.在win2k机上,“网络邻居”|“整个网络”|“全部内容”|“microsoft windows 网络”
| “Workgroup1”,看到RH系统的机器了吗?<br>
7.不用密码就可以进入了,是吗?你看到几个共享目录?可以写入吗?<br>
注意:1) 当你模仿[homes]段修改了[public]段的writable,create mode ,directory mode
后,可以写入吗?<br>
2) 你修改了RH8.0机的/mnt/读写权限为drwxrwxrwx时,情况怎么样呢?<br>
实验四:在linux上挂载samba共享。<br>
[实验要求]<br>
1.一台RH8.0机,一台Win2k机,互相能ping通。<br>
2.RH8.0机,IP:192.168.0.1<br>
3.Win2k机,IP:192.168.0.2<br>
[实验步骤]<br>
1.在win2k机上,共享C:<br>
2.在RH8.0机上运行:<br>
# smbclient //192.168.0.2/C -U win2k的当前登陆用户名%密码<br>
注意:能登陆吗?<br>
3.挂载共享盘:<br>
# mount -t smbfs -o username=win2k的当前登陆名%密码<br>
//192.168.0.2/C /mnt/cdrom<br>
注意:1)“username=win2k的当前登陆名%密码” 之间不要有空格。<br>
2) 也可用:# smbmount //192.168.0.2/C /mnt/cdrom -o username=<br>
username=win2k的当前登陆名%密码<br>
3) 也可用:# smbmount //192.168.0.2/C /mnt/cdrom -U<br>
win2k的当前登陆用户名<br>
接着输入密码便可。<br>
4) 实际,两台都是Linux系统,一台作samba服务器,另一台作客户机。如
实验一的情况下,在机器2上:<br>
# mount -t smbfs -o username=user1%user1<br>
//192.168.0.1/homes /mnt/cdrom<br>
也可实现共享,不过没有必要,linux之间,可以用nfs实现共享,而且速度比
Samba快。<br>
<br>
[实验小结]<br>
本文只是简单快速的学习Sabma,如果想深入了解,需要结合manpage与原
/etc/samba/smb.conf(已备份为smb.conf.BAK)仔细研究,另外,/usr/share/doc/samba
提供了专业文档可以学习。不过,通过本文的学习,已基本满足普通的工作需要。至于
security为domain和server形式,我也没有研究,所以,没有涉及。<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 + -