腾讯视频/爱奇艺/优酷/外卖 充值4折起
系统环境: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以上即为通用一般配置。加入凯发app官网登录需要共享的目录为 /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