![]() |
|
|||||||||||||||
| | 网站首页 | 局域网教程 | 软件说明书 | 深圳电脑城 | | ||
|
||
|
|||||
| 菜鸟篇之samba实现linux与windows共享(下) | |||||
作者:wenwei99 文章来源:本站原创 点击数: 更新时间:2004-6-7 ![]() |
|||||
(接上一篇) 2,通过webmin加linux最基本的配置方法再配置samba 如果我要有一些用户匿名就能打开的linux共享文档, 有一些用户访问需要密码的,但权限比前者大的呢, 哪该怎么设置呢?下面我们就用功能更加强大的webmin配合linux常用的修改方法。 继续吧。 (1),打开你已经安装好的webmin-1.130(我安装的版本是webmin-1.130),什么? 没有安装,哪你就看一下我的上一篇文章《菜鸟篇之webmin的安装》。 Article_Show.asp?ArticleID=999 http://www.landiy.net (这个网站里面有,在操作系统专题) 或者上网搜一下也行。有很多相关的教程。很容易的。:) !!! 首先我们打开IE浏览器,或者linux相关浏览器,输入你的webmin的地址。 默认是你的主机名加上端口号,或者IP地址加上端口号。 然后填入用户名与密码。例如我的是http://wenwei99:12000 或者http://192.168.200.70:12000 提示:webmin 的默认安装的端口是10000 ,用户名是admin
然后按login登录,(图a21)
接着按上面“菜单栏”的“servers”,接着出现很多项服务配置, 点击“Samba Windows 文件共享”。(图a22)
(2),在进入samba共享管理器的界面,主要分为四部份。 1),系统默认的共享文件夹与共享打印机。 2),全局配置 3),samba users 4),重启samba 服务器与 停止samba 服务。 我们把原来的共享文件夹与共享打印机删除掉,让它什么都没有共享。 注意,删除要进入该文件共享界面。(图 a23-a24)
(3),接着我们用终端打开samba的主配置文件。 #vi /etc/samba/smb.conf 内容如下: # This is the main Samba configuration file. You should read the # smb.conf(5) manual page in order to understand the options listed # here. Samba has a huge number of configurable options (perhaps too # many!) most of which are not shown in this example # # Any line which starts with a ; (semi-colon) or a # (hash) # is a comment and is ignored. In this example we will use a # # for commentry and a ; for parts of the config file that you # may wish to enable # # NOTE: Whenever you modify this file you should run the command "testparm" # to check that you have not made any basic syntactic errors. # #======================= Global Settings ===================================== [global] 全局设置 log file = /var/log/samba/%m.log (samba的日志文件所在位置) client code page = 936 (显示简体中文,没有的话就加上) load printers = yes (允许共享打印机) smb passwd file = /etc/samba/smbpasswd (设置samba口令文件的位置) obey pam restrictions = yes (当用认认证时,服从pam管理限制,) socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 guest ok = yes (可以使用来宾帐号进行访问) encrypt passwords = yes (密码是否加密) dns proxy = no (不为客户机做DNS查询) netbios name = wenwei99 (你的机器名) server string = redhat 9.0 samba server (服务器说明,注释) printing = cups (设置打印系统类型,我这里没有打印机,学生穷吗) unix password sync = yes (设置samba用户与系统中的帐号同步) workgroup = kkk (工作组名) os level = 20 (主浏览器优先级为20) printcap name = /etc/printcap (打印文件位置) security = share (四个安全级别中的最低级,共享) max log size = 0 (最大的日记文件为零,你可以设为大一点) pam password change = yes (当用户要求更改密码时用pam的方式) hosts allow = 192.168.200. (仅此网段的主机可以访问,没有的话表示所有)
(4),现在我们通过webmin来创建一个共享目录,这个目录在/tmp/student 下,谁都可以 访问,但只有读的权限。进到如(图a24),点击“创建新的文件共享”。 (5),在弹出的界面填入以下信息。(图a26)
(6),然后点击左下角的“口令和访问控制”。填入以下信息。(图a27)。
仅允许:192.168.200. 是指只有这个网段的计算机才可以访问,当然也可以是一台。要注意后面还有一个 “。”点。
接着按左下角的“Save” 保存退出口令和访问控制,来到(图 a26), 再按“Save”保存,来到samba 主界面,你会发现多了一行。(图a28)
(7),然后我们拉动右边的滚动条到最下面。按 “重新启动samba服务器”,重新启动samba。(如图a29)
现在我们就可以用windows 或者linux匿名访问这台linux共享的啦,:)
现在我们再查看samba的主配置文件多了些什么? #vi /etc/samba/smb.conf
内容如下: # This is the main Samba configuration file. You should read the # smb.conf(5) manual page in order to understand the options listed # here. Samba has a huge number of configurable options (perhaps too # many!) most of which are not shown in this example # # Any line which starts with a ; (semi-colon) or a # (hash) # is a comment and is ignored. In this example we will use a # # for commentry and a ; for parts of the config file that you # may wish to enable # # NOTE: Whenever you modify this file you should run the command "testparm" # to check that you have not made any basic syntactic errors. # #======================= Global Settings ===================================== [global] log file = /var/log/samba/%m.log smb passwd file = /etc/samba/smbpasswd load printers = yes client code page = 936 socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 obey pam restrictions = yes guest ok = yes encrypt passwords = yes dns proxy = no netbios name = wenwei99 server string = redhat 9.0 samba server printing = cups unix password sync = yes workgroup = kkk os level = 20 printcap name = /etc/printcap security = share max log size = 0 pam password change = yes
[alluser] comment = this is all user guest only = yes path = /tmp/student allow hosts = 192.168.200. deny hosts = all 是不是多了一个“[alluser]“和它的下面几行。
(8),下面我们继续,我们建一个用户可以访问的,可读可写,不过要密码才可以访 问。 首先我们们把linux系统用户加到samba的smbpasswd中, (因这默认这个smbpasswd是不存在的) # cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd 设置文件和目录的权限。为了安全一点。 #chown root.root /etc/samba/smbpasswd (改变文件的拥有者为root) #chmod 500 /etc/samba (让这个文件夹的拥有者可读可执行) #chmod 600 /etc/samba/smbpasswd (这个文件的拥有者可读可写) #useradd hww (创建一用户) #passwd hww (更改密码) 输入两次相同的密码,不要少于6位喔。 #smbpasswd -a hww (把hww这个用户加到samba的账号里) 输入两次相同的密码。 如果显示Added user hww. 表示成功啦。 接着我们创一个目录给hww作共享目录。 # mkdir -p /var/samba/hww (hww的共享目录,-p表示多级目录) # chown hww . hww /var/samba/hww (把这个文件夹权限给hww) # vi /etc/samba/smb.conf (打开主samba的主配置文件)。 在最后面加入以下的内容,(当然你可以通过webmin创建),两种都行,我试了几次的。 [hwwsdir] comment = hww's service path = /var/samba/hww valid users = hww public = yes writable = yes read only = no 然后保存退出。 #/etc/rc.d/init.d/smb restart 重启之后就行啦,现在你用windows访问这台wenwei99的linux. 里面有两个文件夹,一个 alluser不用密码,一个hwwsdir要密码。
在终端查看wenwei99这台linux共享可以输入: # smbclient -L \\192.168.200.70 (注意L是大写的,200.70是我这台linux的IP) 如果想用某个用户名查看可以输入: # smbclient -L \\192.168.200.70 -U hww 注:如果有出现不能访问的。在看linxu中的防墙是否允许。 你可以执行# /etc/rc.d/init.d/iptables stop 停掉防火墙。 好了,就到此吧,本人是一只菜鸟。 写得不好之处敬请指出,多谢! 下篇我再写《菜鸟篇之proftd的安装与配置》 wenwei99 于2004-5-24。 |
|||||
| 文章录入:wenwei99 责任编辑:wenwei99 | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 最新热点 | 最新推荐 | 相关文章 | ||
| 菜鸟篇之samba实现linux与wi |
| 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
| | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | | |||||
|