开发者社区> 白及88> 正文

centos 5.6 简单搭建samba服务器

简介: <div style="top:0px"> <p style="line-height:23px; font-family:Arial; font-size:14px; margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px"> </p> <p style="line-height:23.8px;
+关注继续查看


centos 5.6 


Samba是Unix/Linux下与Windows通信的一个开源软件,在RHEL5下是默认安装好其客户端的,我当前系统是CentOS5.6 x86-64

  1. [root@tongji_bak ~]# cat /etc/issue  
  2. CentOS release 5.6 (Final)  
  3. Kernel \r on an \m  
  4.   
  5. [root@tongji_bak ~]# rpm -qa|grep samba  
  6. samba-client-3.0.33-3.29.el5_5.1  
  7. samba-common-3.0.33-3.29.el5_5.1  
  8. [root@tongji_bak ~]#  

在CentOS5.6介质中找到samba-3.0.33-3.29.el5_5.1.x86_64.rpm并且安装

  1. [root@tongji_bak opt]# ll  
  2. 总计 16716  
  3. -rw-r--r-- 1 root root 17091778 10-24 21:14 samba-3.0.33-3.29.el5_5.1.x86_64.rpm  
  4. [root@tongji_bak opt]# rpm -ivh samba-3.0.33-3.29.el5_5.1.x86_64.rpm   
  5. warning: samba-3.0.33-3.29.el5_5.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897  
  6. error: Failed dependencies:  
  7.     perl(Convert::ASN1) is needed by samba-3.0.33-3.29.el5_5.1.x86_64  
  8. [root@tongji_bak opt]#  

如果出现以上安装错误,需要先安装perl-Convert-ASN1-0.20-1.1.noarch.rpm

  1. [root@tongji_bak opt]# ll  
  2. 总计 16760  
  3. -rw-r--r-- 1 root root    42523 10-24 21:19 perl-Convert-ASN1-0.20-1.1.noarch.rpm  
  4. -rw-r--r-- 1 root root 17091778 10-24 21:14 samba-3.0.33-3.29.el5_5.1.x86_64.rpm  
  5. [root@tongji_bak opt]# rpm -ivh perl-Convert-ASN1-0.20-1.1.noarch.rpm   
  6. warning: perl-Convert-ASN1-0.20-1.1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897  
  7. Preparing...                ########################################### [100%]  
  8.    1:perl-Convert-ASN1      ########################################### [100%]  
  9. [root@tongji_bak opt]# rpm -ivh samba-3.0.33-3.29.el5_5.1.x86_64.rpm   
  10. warning: samba-3.0.33-3.29.el5_5.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897  
  11. Preparing...                ########################################### [100%]  
  12.    1:samba                  ########################################### [100%]  
  13. [root@tongji_bak opt]#  

samba安装成功,启动samba服务

  1. [root@tongji_bak opt]# /etc/rc.d/init.d/smb start  
  2. 启动 SMB 服务:                                            [确定]  
  3. 启动 NMB 服务:                                            [确定]  
  4. [root@tongji_bak opt]#  

查看samba监听的端口

  1. [root@tongji_bak opt]# netstat -anp|grep smbd  
  2. tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      17839/smbd            
  3. tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN      17839/smbd            
  4. unix  2      [ ]         DGRAM                    121836 17839/smbd            
  5. [root@tongji_bak opt]# netstat -anp|grep nmbd  
  6. udp        0      0 192.168.107.190:137         0.0.0.0:*                               17842/nmbd            
  7. udp        0      0 0.0.0.0:137                 0.0.0.0:*                               17842/nmbd            
  8. udp        0      0 192.168.107.190:138         0.0.0.0:*                               17842/nmbd            
  9. udp        0      0 0.0.0.0:138                 0.0.0.0:*                               17842/nmbd            
  10. [root@tongji_bak opt]#  

测试Windows客户端能否访问samba服务器,输入服务器IP看见以下图片,说明通信成功,注意不能直接使用OS用户登录


创建samba用户

  1. [root@tongji_bak opt]# useradd smbuser1  
  2. [root@tongji_bak opt]# passwd smbuser1  
  3. Changing password for user smbuser1.  
  4. New UNIX password:   
  5. BAD PASSWORD: it is based on a dictionary word  
  6. Retype new UNIX password:   
  7. passwd: all authentication tokens updated successfully.  
  8. [root@tongji_bak opt]# smbpasswd -a smbuser1  
  9. New SMB password:  
  10. Retype new SMB password:  
  11. Added user smbuser1.  
  12. [root@tongji_bak opt]#  

添加的samba用户都是在OS的一个文件当中,我们可以通过以下命令查看

  1. [root@tongji_bak opt]# more /etc/samba/passdb.tdb   
  2. TDB file  
  3.   
  4. ser1  
  5. smbuser1  

使用smbuser1用户登录,访问samba服务器

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
CentOS手把手教你搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台(三)
CentOS手把手教你搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台
37 0
CentOS手把手教你搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台(二)
CentOS手把手教你搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台
30 0
CentOS手把手教你搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台(一)
CentOS手把手教你搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台
36 0
CentOS 7手把手教你搭建GitLab(二)
CentOS 7手把手教你搭建GitLab
68 0
CentOS 7手把手教你搭建GitLab(一)
CentOS 7手把手教你搭建GitLab
53 0
手把手教你CentOS下搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台(三)
手把手教你CentOS下搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台
32 0
手把手教你CentOS下搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台(二)
手把手教你CentOS下搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台
42 0
手把手教你CentOS下搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台(一)
手把手教你CentOS下搭建Zabbix Server,Zabbix Proxy,Zabbix Agent企业级监控平台
51 0
Centos通过Docker搭建MySQL的PXC集群
Centos通过Docker搭建MySQL的PXC集群
106 0
Centos下搭建Hadoop伪分布式(二)
Centos下搭建Hadoop伪分布式
38 0
+关注
白及88
白及
文章
问答
文章排行榜
最热
最新
相关电子书
更多
网站/服务器取证 实践与挑战
立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手
立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册
立即下载