Chinaunix首页 | 论坛 | 博客
  • 博客访问: 420434
  • 博文数量: 122
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 688
  • 用 户 组: 普通用户
  • 注册时间: 2013-09-04 12:30
文章分类

全部博文(122)

文章存档

2017年(5)

2016年(4)

2015年(56)

2014年(41)

2013年(16)

我的朋友

分类: LINUX

2014-12-25 19:40:59

本文转自:http://blog.csdn.net/skdkjzz/article/details/42101363
1、首先安装samba

yum install samba

2、查看安装信息

rpm -qi samba,正常显示如下

3、配置内核相关参数

ulimit -n 16384 && vim /etc/security/limits.conf,增加内容如下:

* - nofile 16384

4、关闭防火墙和selinux服务或者在iptables里放开445和139端口,并重启iptables服务

systemctl stop firewalld.service 和setenforce 0

chkconfig –level 35 iptables off 或者 systemctl disable firewalld.service (永久关闭)

关闭selinux:
/etc/sysconfig/selinux里设置 SELINUX=disabled 即可,reboot生效。

5、配置smb.conf

配置smb.conf ,vim /etc/samba/smb.conf

smb.conf 配置内容

[global]

workgroup = cmcc

netbios name = cmcc1
server string = Linux Samba Server TestServer
security = user #在samba4中 share 和 server已经被禁用

map to guest =Bad User

[cmcc]
path = /opt/cmcc
writeable = yes
browseable = yes

guest ok= yes

注意:在samba4中 share 和 server已经被禁用,需要用security = user 和map to guest =Bad User来实现无密码访问目录

6、启动smb服务

systemctl start samba.service

systemctl restart samba.service

systemctl enable samba.service

7、查看smb状态

systemctl status samba.service

8、测试smb连通性

smbclient -L localhost -U

正常显示如下:

9、添加开机启动smb

chkconfig --level 345 smb on

10、无密码登录smb.conf实例:

[global]
 max log size = 50
 workgroup=WORKGROUP
 display charset = UTF-8  
 unix charset = UTF-8  
 dos charset = cp936 
 security = share
 passdb backend = tdbsam
 load printers = yes
 cups options = raw 
[files]
        comment = parent
        path = /root
        writeable = yes
        public = yes     
        guest ok = yes  
        browseable = yes
        create mask = 0777
        directory mask = 0777

11、其他参考

http://blog.csdn.net/gaoxuefeng/article/details/7327750

阅读(1726) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~