全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
samba是一个文件共享协议,用于在计算机之间共享文件。linux支持支持samba协议。但在linux系统之间进行文件共享时,一般使用nfs。samba一般用于linux 和windows之间的文件共享,在服务器环境中,Windows服务器对设备的支持较好,比如一些备份设备;上层的应用软件也可能需要linux的文件,由于windows 2003及以下版本对nfs支持不好,在linux和Windows之间共享文件一般用samba。假设有一台磁带机安装在Windows Server下,为了实现备份linux的文件,则需要linux系统安装samba服务,发布共享目录,便于Windows系统共享和备份。(一)安装SMBrootmyserver # rpm -q sambapackage samba is not installedrootmyserver # mount /dev/cdrom /mntmount: block device /dev/cdrom is write-protected, mounting read-onlyrootmyserver # cd /mnt/Serverrootmyserver Server# ls *samba*samba-3.0.23c-2.i386.rpm samba-swat-3.0.23c-2.i386.rpmsamba-client-3.0.23c-2.i386.rpm system-config-samba-1.2.39-1.el5.noarch.rpmsamba-common-3.0.23c-2.i386.rpmrootmyserver Server# rpm -ivh samba-3.0.23c-2.i386.rpm warning: samba-3.0.23c-2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing. # 100% 1:samba # 100%rootmyserver Server# service smb statussmbd 已停nmbd 已停rootmyserver Server# service smb start启动 SMB 服务: 确定启动 NMB 服务: 确定为了让windows 访问共享,需要先添加一个系统帐户,并为该帐户设置smb密码,该密码和linux帐户密码可以不同,以便保证即使知道共享密码也不能直接登入linux。rootmyserver samba# useradd smbwinrootmyserver samba# smbpasswd -a smbwinNew SMB password:Retype new SMB password:Added user smbwin.rootmyserver samba# cat smbpasswdsmbwin:504:44EFCE164AB921CAAAD3B435B51404EE:32ED87BDB5FDC5E9CBA88547376818D4:U :LCT-4A55A486:rootmyserver samba# gedit smb.conf添加一个名为attshare的共享,共享上个实验中nfs服务器对应的/nfs目录,以便Windows备份该目录的文件,共享用户为smbwin,可读不可写:attsharecomment=nfs attachment sharepath=/nfsvalid users=smbwinpublic=nowritable=no保存。rootmyserver samba# service smb restart关闭 SMB 服务: 确定关闭 NMB 服务: 确定启动 SMB 服务: 确定启动 NMB 服务: 确定在windows 下,打开资源管理器或浏览器,在地址栏中输入55,输入smbwin用户和密码,即可看到对应的共享目录了。(二)samba配置文件smb.conf文件的功能包括:global模拟域名或工作组名 workgroup = MYGROUP服务器名 server string = Samba Server安全模式,用户服务器域活动目录 security = userIP地址过滤; hosts allow = 192.168.1. 192.168.2. 127.打印机共享 load printers = yes打印机共享名; printcap name = /etc/printcap; printcap name = lpstat 打印系统类型# bsd, cups, sysv, plp, lprng, aix, hpux, qnx; printing = cups# This option tells cups that the data has already been rasterizedcups options = raw匿名用户组# Uncomment this if you want a guest account, you must add this to /etc/passwd# otherwise the user nobody is used; guest account = pcguest日志记录# this tells Samba to use a separate log file for each machine# that connects log file = /var/log/samba/%m.log日志最大大小K# Put a capping on the size of the log files (in Kb). max log size = 50当安全限定为服务器时的服务器密码# Use password server option only with security = server# The argument list may include:# password server = My_PDC_Name My_BDC_Name My_Next_BDC_Name# or to auto-locate the domain controller/s# password server = *; password server = 安去限定为活动目录时名称# Use the realm option only with security = ads# Specifies the Active Directory realm the host is part of; realm = MY_REALM附加配置文件; include = /usr/local/samba/lib/smb.conf.%m网卡IP地址使用限定; interfaces = /24 /24 默认用户目录共享homes comment = Home Directories browseable = no writable = yes默认打印机共享printers comment = All Printers path = /usr/spool/samba browseable = no# Set public = yes to allow user guest account to print guest ok = no writable = no printable = yes共享实例myshare;myshare共享名称说明; comment = Marys and Freds stuff路径; path = /usr/somewhere/shared用户; valid users = mary fred是否公开; public = no是否可写; writable = yes是否打印机; printable = no掩码; create mask = 0765(三) 使用smbclient 在linux下访问smb共享rootmyserver Server# rpm -ivh samba-client-3.0.23c-2.i386.rpm warning: samba-client-3.0.23c-2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing. # 100% 1:samba-client # 100%rootmyserver Server# 以某用户身份列某服务器上的共享目录安装smbclient客户端rootmyserver samba# smbclient -L /myserver -U smbwinPassword: Domain=MYSERVER OS=Unix Server=Samba 3.0.23c-2 Sharename Type Comment - - - attshare Disk nfs attachment share IPC$ IPC IPC Service (Samba Server) smbwin Disk Home DirectoriesDomain=MYSERVER OS=Unix Server=Samba 3.0.23c-2 Server Comment - - Workgroup Master - - MYGROUP 以某用户身份访问共享目录rootmyserver samba# smbclient /myserver/attshare -U smbwinPassword: Domain=MYSERVER OS=Unix Server=Samba 3.0.23c-2smb: ls . D 0 Thu Jul 9 10:31:15 2009 . D 0 Sat Jul 25 08:22:11 2009 111 D 0 Thu Jul 9 09:29:56 2009 a.txt 17 Thu Jul 9 09:28:39 2009 att.tar 10240 Sun Jul 8 10:27:49 2007 attachment D 0 Thu Jul 9 10:44:33 2009 58113 blocks of size 262144. 46514 blocks available使用方式与FTP命令类似smb: help? altname archive blocksize cancel case_sensitive cd chmod chown del dir du exit get getfacl hardlink help history lcd link lowercase ls mask md
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年迪士尼玩偶秒售罄背后:情绪价值潮玩从单一品牌向品类化爆发演进
- 电力工程机组循环水砼管线更换为钢管工程技术方案
- 2026年低温启停与怠速高电位影响因素控制
- 2026年消防通道清理培训
- 2026年中小企业DCMM贯标低成本路径与分阶段实施策略
- 2026年网络安全知识竞赛
- 2026年手足口病预防控制课件
- 2026年实验室安全手册
- 老年人皮肤护理与常见问题处理
- 2025-2026学年重庆市忠县七年级(上)期末历史试卷(含答案)
- 2026年陕西工业职业技术学院单招职业技能测试题库带答案详解(新)
- 2026届湖北省武汉市高三三月调研考试英语试卷(含答案)
- 2026广东茂名市公安局茂南分局招聘警务辅助人员20人考试参考题库及答案解析
- 市域产教联合体绩效考核体系制度
- 2026年1月浙江省高考(首考)化学试题(含标准答案)
- 2026年及未来5年中国激光设备行业市场前景预测及投资战略研究报告
- 2026年演出经纪人考试题库含答案(考试直接用)
- 清廉社区制度规范
- 2026华泰证券招聘面试题及答案
- 农村宅基地执法培训课件
- 建筑工程项目管理全过程指导手册
评论
0/150
提交评论