Fedora-8下Samba服务器的架设笔记
07-18
系统环境:Windows xp sp3 ,IP:192.168.1.10 虚拟机下安装了Fedora-8-i386 IP:192.168.1.121. 首先检查os是否安装好了samba。[root@cisco samba]# rpm -qa | grep smb如果出现下面三行内容,则表示已经安装好了Sambalibsmbios-libs-0.13.10-1.fc8libsmbios-bin-0.13.10-1.fc8pam_smb-1.1.7-7.2.2如果没有安装后好,需要进入安装关盘Fedora-8-i386-DVD.iso[root@cisco /]# mount /dev/cdrom /mnt/cdrom/mount: block device /dev/sr0 is write-protected, mounting read-only[root@cisco /]# cd /mnt/cdrom/[root@cisco cdrom]# lsfedora.css isolinux README-BURNING-ISOS-en_US.txt repoview RPM-GPG-KEY-fedora RPM-GPG-KEY-rawhideGPL media.repo RELEASE-NOTES-en_US.html RPM-GPG-KEY RPM-GPG-KEY-fedora-rawhide stylesheet-imagesimages Packages repodata RPM-GPG-KEY-beta RPM-GPG-KEY-fedora-test TRANS.TBL[root@cisco cdrom]# cd Packages/[root@cisco Packages]# rpm -ivh -aid smb*即可安装成功。2. 进入samba目录[root@cisco /]# cd /etc/samba/[root@cisco samba]# lslmhosts smb.conf smbpasswd smbusers这里的smb.conf是samba服务器的主要配置文件。还要注意一点,smbpasswd文件是用来存储用户帐号和经过md5加密后的密码。刚安装好samba服务时,此文件不存在。需要手工创建。下面会介绍。3. 编辑smb.conf文件[root@cisco samba]# vi smb.conf进行如下设置:#======================= Global Settings =====================================[global]workgroup = MSHOME 将linux 加入的工作组名,我这里加入了MSHOME工作组。server string = Samba 这是服务器描述信息,方便标志资源。可以随便输入。encrypt passwords = yes 表示是否对用户的密码进行加密,这里选择加密,安全!public = yes 定义一个共享是否对公共访问开放。当设置为 yes 时,在系统上没有帐户用户将基于所定义的客户帐户的属性来接收访问。smb passwd file = /etc/samba/smbpasswd 这是账号密码的存放文件netbios name = mm's samba 在外部访问该samba服务器时,显示的信息。# --------------------------- Logging Options -----------------------------# logs split per machinelog file = /var/log/samba/log.%m log文件的存放位置。# max 50KB per log file, then rotatemax log size = 0 log文件的大小限制,设置为0表示不做限制。# ----------------------- Standalone Server Options ------------------------security = user 共享的安全级别,samba有四种安全等级:share:用户不需要账户及密码即可登录samba服务器user:由提供服务的samba服务器负责检查账户及密码(默认)server:检查账户及密码的工作由另一台windows或samba服务器负责domain:指定windows域控制服务器来验证用户的账户及密码)passdb backend = tdbsam以上即为通用一般配置。加入我们需要共享的目录为 /opt/需要添加如下代码:[rose]comment = This is my samba server! 设置共享信息,随便输入path = /opt 共享目录valid users = testuser 可以访问次共享目录的用户,我这里设为testuser用户public = yes 同上面的解释writable = yes 用户是否可写,这里我们允许。wq!保存退出即可。4. 启动smb服务[root@cisco samba]# service smb startStarting SMB services: [ OK ][root@cisco samba]# service nmb startStarting NMB services: [ OK ]5. 添加可以访问我们刚才设置共享目录的用户:testuser1)建一个系统用户[root@linux samba]# useradd testuser (建一个名叫testuser的用户)[root@linux samba]# passwd t (给testuser用户添加密码)Changing password for user samba.New password: (密码要六位以上,不显示在屏幕上)BAD PASSWORD: it does not contain enough DIFFERENT charactersRetype new password: (确认密码)passwd: all authentication tokens updated successfully2) 更新 /etv/samba/smbpasswd 文件[root@linux samba]# cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd3) 然后创建samba帐户[root@cisco samba]# smbpasswd -a testuserNew SMB password:Retype new SMB password:Added user testuser.6. 重新启动smb服务[root@cisco samba]# service smb restartShutting down SMB services: [ OK ]Starting SMB services: [ OK ][root@cisco samba]# service nmb restartShutting down NMB services: [ OK ]Starting NMB services: [ OK ]下面我们在Windows下测试一下,我的系统为Windows xp sp3在Linux 下访问Windows的共享资源,显示信息为:[root@cisco samba]# smbclient -L //192.168.1.10Password:Domain=[XPSP3] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]Sharename Type Comment--------- ---- -------
Printer Adobe PDF Office Document Image Writersession request to 192.168.1.10 failed (Called name not present)session request to 192 failed (Called name not present)Domain=[XPSP3] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]Server Comment--------- -------Workgroup Master--------- -------在Linux 下访问自己的samba服务器,显示信息为:[root@cisco samba]# smbclient -L //192.168.1.12Password:Anonymous login successfulDomain=[MSHOME] OS=[Unix] Server=[Samba 3.0.26a-6.fc8]Sharename Type Comment--------- ---- -------homes Disk Home Directoriesrose Disk This is my samba server!test-1 Disk This is my samba server!IPC$ IPC IPC Service (Samba)Anonymous login successfulDomain=[MSHOME] OS=[Unix] Server=[Samba 3.0.26a-6.fc8]Server Comment--------- -------MM'S SAMBA SambaWorkgroup Master--------- -------MSHOME