SambaServer基本配置汇总 - 图文
Redhat Enterprise Linux 6.2 samba服务配置
一,虚拟机打开后,添加rehl-server-6.2镜像文件
第一步,
第二步:
一、安装前准备
1、使用Samba服务器需要防火墙开放以下端口
UDP 137 UDP 138 TCP 139 TCP 445 #配置防火墙端口
[root@roothomes ~] vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT #重启防火墙,使规则生效
[root@roothomes ~] /etc/rc.d/init.d/iptables restart
2、关闭CentOS6系统的 SELinux
[root@roothomes ~] vi /etc/selinux/config #SELINUX=enforcing #注释掉 #SELINUXTYPE=targeted #注释掉 SELINUX=disabled #增加 #:wq 保存。 #重启系统
[root@roothomes ~] shutdown -r now 或者 init 6
二、安装Samba
1、检查Samba服务包是否已安装
[root@roothomes ~] rpm -qa | grep samba samba-3.5.4-68.el6.x86_64
samba-common-3.5.4-68.el6.x86_64 samba-client-3.5.4-68.el6.x86_64
samba4-libs-4.0.0-23.alpha11.el6.x86_64 samba-winbind-clients-3.5.4-68.el6.x86_64
说明samba已经安装,如果没有安装,运行下面命令安装 [root@roothomes ~] yum install samba
2、配置samba
[root@roothomes ~] chkconfig smb on #设置 Samba开机自动启动 [root@roothomes ~] service smb start #启动Samba服务 [root@roothomes ~] /etc/init.d/smb restart #重启 [root@roothomes ~] /etc/init.d/smb stop #停止 [root@roothomes ~] cp
/etc/samba/smb.conf /etc/samba/bak_smb.conf_bak #备份 [root@roothomes ~] cp
/etc/samba/bak_smb.conf_bak /etc/samba/smb.conf #恢复 [root@roothomes ~] vi /etc/samba/smb.conf
[global] #找到这一行(全局设置标签),在此行下面添加如下行: workgroup = WORKGROUP #工作组名称改为 Windows
网络所定义的工作组名
server string = Samba Server #设置samba服务器的主机名称 security = user #设置samba服务器安全级别为user,即以账号和口令访问
netbios name = SambaServer #设置Samba服务器访问别名 #在配置文件的末尾添加以下自定义内容
[SambaServer] #在Windows网上邻居中看到的共享目录的名字 comment = SambaServer #在Windows网上邻居中看到的共享目录的备注信息
path = /home/SambaServer #共享目录在系统中的位置 public = no #不公开目录 writable = yes #共享目录可以读写
valid users=SambaServer #只允许SambaServer用户访问
#保存配置
3、添加访问linux共享目录的账号SambaServer
用户家目录为/home/SambaServer, 用户登录终端设为/bin/false(即使之不能登录系统)
[root@roothomes ~] mkdir -p /home/SambaServer #建立SambaServer文件夹 [root@roothomes ~] cd /home/SambaServer
[root@roothomes ~] touch samba.txt #创建测试文件samba.txt [root@roothomes ~] useradd SambaServer -d /home/SambaServer -s /bin/false
[root@roothomes ~] chown SambaServer:SambaServer /home/SambaServer -R
4、将用户SambaServer添加入到Samba用户数据库,并设置登录共享目录的密码为:123456
[root@roothomes ~] smbpasswd -a SambaServer
New SMB password: 输入该用户用于登录Samba的密码 Retype new SMB password: 再次确认输入该密码 Added user SambaServer.
#备注:这里设置的密码是SambaServer用户登录该机的Samba共享的密码,非登陆OS的密码;
5、重启Samba服务器
[root@roothomes ~] /etc/init.d/smb restart 6、浏览共享信息
在Windows客户端输入 \\\\ip 或者 \\\\SambaServer #服务器别名 回车之后,会跳出来登录框,输入账号SambaServer ,密码123456 , 即可访问共享目录
问题:
如果无法访问共享目录的内容,请把防火墙停止; [root@roothomes ~] service iptables stop
二
1、安装Samba软件包
# yum -y install samba samba-client samba-common samba-winbind samba-winbind-clients
2、启动、查看Samba服务器状态
# service smb start # service smb status
3、设置Samba服务器为开机启动
# chkconfig smb on # chkconfig --list smb
smb 0:off 1:off 2:on 3:on 4:on 6:off
4、修改 Samba 服务器住配置文件 smb.conf
4.1、备份源文件
# cp -p /etc/samba/smb.conf /etc/samba/smb.conf.orig
4.2、在 [global] 部分修改字符集设置
5:on
[global]
unix charset= UTF-8 dos charset=GBK
workgroup = SHAREGROUP
4.3、在文件结尾加上客户自定义共享模块
[share]
comment = RHEL6-Windows Share path=/home/share writeable = yes # 是否可写
browseable = yes # 是否可浏览
create mode = 0777 # 创建文件时的默认属性 directory mode = 0777 # 创建目录时的默认属性 valid users = share # 指定可访问用户
5、添加共享用户
# groupadd -g 1234 share-users
# adduser -d /home/share -m -u 1234 -g 1234 -c \share
# ls -ld /home/share
drwx------. 4 share share-users 4096 11月 28 16:56 /home/share
6、映射刚添加的用户为同名的 samba 用户,并设置samba密码(这个密码不同于系统用户密码!!)
# smbpasswd -a share New SMB password:
Retype new SMB password: Added user demo. #
修改Samba用户信息使用pdbedit命令:
…… 此处隐藏:1942字,全部文档内容请下载后查看。喜欢就下载吧 ……相关推荐:
- [高等教育]公司协助某村精准扶贫工作总结.doc
- [高等教育]高二生物知识点总结(全)
- [高等教育]苏教版数学三年级下册《解决问题的策略
- [高等教育]仪器分析课程学习心得
- [高等教育]2017年五邑大学数学与计算科学学院333
- [高等教育]人教版七年级下册语文第四单元测试题(
- [高等教育]2018年秋七年级英语上册Unit7Howmuchar
- [高等教育]2017年八年级下数学教学工作小结
- [高等教育]湖南省怀化市2019届高三统一模拟考试(
- [高等教育]四年级下册科学_基础训练及答案教材
- [高等教育]城郊煤矿西风井管路伸缩器更换施工安全
- [高等教育]昆八中20182019学年度上学期期末考试
- [高等教育]项目部各类人员任命书
- [高等教育]上市公司经营水务产业的模式
- [高等教育]人教版高二化学第一学期第三章水溶液中
- [高等教育]【中考物理第一轮复习资料】四.压强与
- [高等教育]金坑水电站报废改建工程机电设备更新改
- [高等教育]高中生物教学工作计划简易版
- [高等教育]2017年西华大学攀枝花学院(联合办学)44
- [高等教育]最新整理超短爆笑英文小笑话大全
- 优秀教师继续教育学习心得体会
- 阳历到阴历的转换
- 留守儿童教育案例分析
- 华师17春秋学期《玩教具制作与环境布置
- 测速传感器新型安装装置的现场应用
- 人教版小学数学三年级下册第四单元
- 创业个人意向书
- 山东省潍坊市2012年高考仿真试题(三)
- [恒心][好卷速递]四川省成都外国语学校
- 多少人错把好转反应当成了病情加重处理
- 中外广播电视史复习资料整理
- 江苏省扬州市江都区宜陵镇中学2014-201
- 工程造价专业毕业实习报告
- 广西师范学院心理与教育统计
- aympkrq基于 - asp的博客网站设计与开
- 建筑业外出经营相关流程操作(营改增后
- 人治 德治 法治
- [精华篇]常识判断专项训练题库
- 中国共产党为什么要实行民主集中
- 小学数学第三册第一单元试卷(A、B、C




