samba 服务器的搭建

一,安装samba4

不要直接 yum install samba ,默认安装的是samba3版本,但这个版本有问题(open_rpc_pipe_p: copy_serverinfo failed这个错误)
 
所以这里安装samba4 版本
//查看源
[root@yohuu14 samba]# yum list samba*.*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: centos.ustc.edu.cn
 * updates: mirrors.163.com
Installed Packages
samba4.x86_64                                                                                                              4.0.0-66.el6_6.rc4                                                                                         @base  
samba4-client.x86_64                                                                                                       4.0.0-66.el6_6.rc4                                                                                         @base  
samba4-common.x86_64                                                                                                       4.0.0-66.el6_6.rc4                                                                                         @base  
samba4-libs.x86_64                                                                                                         4.0.0-66.el6_6.rc4                                                                                         @base  
samba4-winbind.x86_64                                                                                                      4.0.0-66.el6_6.rc4                                                                                         @base  
samba4-winbind-clients.x86_64                                                                                              4.0.0-66.el6_6.rc4                                                                                         @base  
Available Packages
samba.x86_64                                                                                                               3.6.23-21.el6_7                                                                                            updates
samba-client.x86_64                                                                                                        3.6.23-21.el6_7                                                                                            updates
samba-common.i686                                                                                                          3.6.23-21.el6_7                                                                                            updates
samba-common.x86_64                                                                                                        3.6.23-21.el6_7                                                                                            updates
samba-doc.x86_64                                                                                                           3.6.23-21.el6_7                                                                                            updates
samba-domainjoin-gui.x86_64                                                                                                3.6.23-21.el6_7                                                                                            updates
samba-glusterfs.x86_64                                                                                                     3.6.23-21.el6_7                                                                                            updates
samba-swat.x86_64                                                                                                          3.6.23-21.el6_7                                                                                            updates
samba-winbind.x86_64                                                                                                       3.6.23-21.el6_7                                                                                            updates
samba-winbind-clients.i686                                                                                                 3.6.23-21.el6_7                                                                                            updates
samba-winbind-clients.x86_64                                                                                               3.6.23-21.el6_7                                                                                            updates
samba-winbind-devel.i686                                                                                                   3.6.23-21.el6_7                                                                                            updates
samba-winbind-devel.x86_64                                                                                                 3.6.23-21.el6_7                                                                                            updates
samba-winbind-krb5-locator.x86_64                                                                                          3.6.23-21.el6_7                                                                                            updates
samba4-dc.x86_64                                                                                                           4.0.0-66.el6_6.rc4                                                                                         base   
samba4-dc-libs.x86_64                                                                                                      4.0.0-66.el6_6.rc4                                                                                         base   
samba4-devel.x86_64                                                                                                        4.0.0-66.el6_6.rc4                                                                                         base   
samba4-pidl.x86_64                                                                                                         4.0.0-66.el6_6.rc4                                                                                         base   
samba4-python.x86_64                                                                                                       4.0.0-66.el6_6.rc4                                                                                         base   
samba4-swat.x86_64                                                                                                         4.0.0-66.el6_6.rc4                                                                                         base   
samba4-test.x86_64                                                                                                         4.0.0-66.el6_6.rc4                                                                                         base   
samba4-winbind-krb5-locator.x86_64                                                                                         4.0.0-66.el6_6.rc4                     
 
[root@yohuu14 samba]# yum install -y samba4
 
[root@yohuu14 samba]# yum install -y samba4-winbind.x86_64 samba4-client.x86_64 samba4-winbind-clients.x86_64 
 
[root@yohuu14 samba]# rpm -qa|grep samba
samba4-winbind-clients-4.0.0-66.el6_6.rc4.x86_64
samba4-client-4.0.0-66.el6_6.rc4.x86_64
samba4-libs-4.0.0-66.el6_6.rc4.x86_64
samba4-4.0.0-66.el6_6.rc4.x86_64
samba4-winbind-4.0.0-66.el6_6.rc4.x86_64
samba4-common-4.0.0-66.el6_6.rc4.x86_64
 
 
二,设置防火墙
 
-A INPUT -m state --state NEW -m tcp -p tcp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 138 -j ACCEPT
-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
三,授权共享权限 
 
useradd operate
 
smbpasswd -a  operate //添加smb登录用户并设置密码(注意系统中必须存在相同的用户名)
 
smbpasswd -x  operate //删除
 
[root@yohuu14 samba]# cat smb.conf
[global]
server string = Samba Server
dos charset = GB2312
unix charset = GB2312
display charset = GB2312
security = share
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
 
[share]
public = yes
path = /home/samba/share   //无密码即可访问可以设置 chown nobody.nobody /home/samba/share 和 chmod 777 /home/samba/share
 
[operate]
workgroup = operate
netbios name= operate
path = /home/samba/operate  //chown operate.operate /home/samba/share 和 chmod 777 /home/samba/operate
browseable = yes
writeable = yes
 
 
四,重启服务
service smb restart
 
windows 中
运行cmd 中//IP 访问,输入上面设置密码即可。
 
 
 
 
 
 
posted @ 2015-12-24 11:54  itank  阅读(1115)  评论(0编辑  收藏  举报