本文的目的主要用来说明如何在CentOS6.5的环境下配置出一个简单可用的samba服务,并且可以通过windows对其文件进行访问
# yum install samba samba-client samba-commo <span class="com"># chkconfig smb on</span><span class="com"> # chkconfig nmb on</span><span class="com"></span>
# iptables -I INPUT 4 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT # iptables -I INPUT 5 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT # iptables -I INPUT 6 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT # service iptables save
在正式配置之前,对配置文件进行备份
# cp /etc/samba/smb.conf /etc/samba/smb.conf.bak # rm /etc/samba/smb.conf # touch /etc/samba/smb.conf # vi /etc/samba/smb.conf
配置一个公开的访问目录,在新创建的smb.conf文件中加入以下配置 <pre name="code" class="plain">#======================= Global Settings ===================================== [global] workgroup = WORKGROUP security = share map to guest = bad user #============================ Share Definitions ============================== [MyShare] path = /home/samba/share browsable =yes writable = yes guest ok = yes read only = no
<pre style="" class="wp-code-highlight prettyprint linenums:1 prettyprinted"><span class="com"># chmod -R 0777 /home/samba/share</span> <pre style="" class="wp-code-highlight prettyprint linenums:1 prettyprinted"><span class="com"># testparm</span># service smb restart# service nmb restart
添加相关的操作员以及组配置 <pre name="code" class="plain"> # useradd smbuser # groupadd smbgrp # usermod -a -G smbgrp smbuser # smbpasswd -a smbuser
# cd /home/samba/ # mkdir secure # chown -R arbab:smbgrp secure/ # chmod -R 0770 secure/
[Secure] path = /home/samba/secure valid users = @smbgrp guest ok = no writable = yes browsable = yes
# testparm # service smb restart # service nmb restart
<p> 如果出现无权限访问的问题,可以通过关闭防火墙以及selinux来尝试 </p><pre name="code" class="plain"> # service iptables stop # setenforce 0
在Centos6.5下Samba的简单配置,布布扣,bubuko.com
原文:http://blog.csdn.net/eric_sunah/article/details/38268133