多米诺骨牌源
最快捷的苹果资讯

centos7 和 Ubuntu samba安装与配置

1、关闭防火墙。

    CentOS 7 是自带的firewall,CentOS 6 好像是iptables。关闭防火墙命令如下:

   第一种方法是关闭防火墙:

systemctl disable firewalld.service

 第二种方法是添加规则:

firewall-cmd --permanent --zone=public --add-service=samba
firewall-cmd --reload

2、关闭selinux

vim /etc/selinux/config
设置:SELINUX=disabled

1、安装

yum install samba samba-client samba-common -y

2、配置

备份已有配置

mv /etc/samba/smb.conf /etc/samba/smb.conf.bkp

添加新的配置

vi /etc/samba/smb.conf

输入以下内容

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ============================== 
[Public]
path = /data/share/
writable = yes
browsable = yes
guest ok = yes
guest only = yes
create mode = 0777
directory mode = 0777

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

配置启动服务

mkdir -p /data/share/public
systemctl enable smb.service
systemctl enable nmb.service
systemctl restart smb.service
systemctl restart nmb.service

设置防火墙

firewall-cmd --permanent --zone=public --add-service=samba
firewall-cmd --reload

修改目录访问权限

chmod -R 0777  /data/share/public
chown -R nobody:nobody  /data/share/public

WINDOWS输入\\centos 访问

 安装

sudo apt-get install samba

2 配置

mv /etc/samba/smb.conf /etc/samba/smb.conf.bkp
vi /etc/samba/smb.conf
[global] workgroup = WORKGROUP
server string = Samba Server %v 
netbios name = centos security = user
 map to guest = bad 
user dns proxy = no 
#============================ Share Definitions ==============================  
[Public] path = /home/*/ 
writable = yes 
browsable = yes guest ok = yes 
guest only = yes 
create mode = 0777 
directory mode = 0777
sudo service smbd restart


未经允许不得转载:多米诺骨牌 » centos7 和 Ubuntu samba安装与配置
分享到:

评论 抢沙发

提交评论

  •   昵称 (必填)
  • 邮箱 (必填)
  • 网址 (选填)