Samba是Unix/Linux下与Windows通信的一个开源软件,在RHEL5下是默认安装好其客户端的,我当前系统是CentOS5.6 x86-64
[root@tongji_bak ~]# cat /etc/issue
CentOS release 5.6 (Final)
Kernel \r on an \m
[root@tongji_bak ~]# rpm -qa|grep samba
samba-client-3.0.33-3.29.el5_5.1
samba-common-3.0.33-3.29.el5_5.1
[root@tongji_bak ~]#
在CentOS5.6介质中找到samba-3.0.33-3.29.el5_5.1.x86_64.rpm并且安装
[root@tongji_bak opt]# ll
总计 16716
-rw-r--r-- 1 root root 17091778 10-24 21:14 samba-3.0.33-3.29.el5_5.1.x86_64.rpm
[root@tongji_bak opt]# rpm -ivh samba-3.0.33-3.29.el5_5.1.x86_64.rpm
warning: samba-3.0.33-3.29.el5_5.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
perl(Convert::ASN1) is needed by samba-3.0.33-3.29.el5_5.1.x86_64
[root@tongji_bak opt]#
如果出现以上安装错误,需要先安装perl-Convert-ASN1-0.20-1.1.noarch.rpm
[root@tongji_bak opt]# ll
总计 16760
-rw-r--r-- 1 root root 42523 10-24 21:19 perl-Convert-ASN1-0.20-1.1.noarch.rpm
-rw-r--r-- 1 root root 17091778 10-24 21:14 samba-3.0.33-3.29.el5_5.1.x86_64.rpm
[root@tongji_bak opt]# rpm -ivh perl-Convert-ASN1-0.20-1.1.noarch.rpm
warning: perl-Convert-ASN1-0.20-1.1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:perl-Convert-ASN1 ########################################### [100%]
[root@tongji_bak opt]# rpm -ivh samba-3.0.33-3.29.el5_5.1.x86_64.rpm
warning: samba-3.0.33-3.29.el5_5.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:samba ########################################### [100%]
[root@tongji_bak opt]#
samba安装成功,启动samba服务
[root@tongji_bak opt]# /etc/rc.d/init.d/smb start
启动 SMB 服务: [确定]
启动 NMB 服务: [确定]
[root@tongji_bak opt]#
查看samba监听的端口
[root@tongji_bak opt]# netstat -anp|grep smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 17839/smbd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 17839/smbd
unix 2 [ ] DGRAM 121836 17839/smbd
[root@tongji_bak opt]# netstat -anp|grep nmbd
udp 0 0 192.168.107.190:137 0.0.0.0:* 17842/nmbd
udp 0 0 0.0.0.0:137 0.0.0.0:* 17842/nmbd
udp 0 0 192.168.107.190:138 0.0.0.0:* 17842/nmbd
udp 0 0 0.0.0.0:138 0.0.0.0:* 17842/nmbd
[root@tongji_bak opt]#
测试Windows客户端能否访问samba服务器,输入服务器IP看见以下图片,说明通信成功,注意不能直接使用OS用户登录
创建samba用户
[root@tongji_bak opt]# useradd smbuser1
[root@tongji_bak opt]# passwd smbuser1
Changing password for user smbuser1.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@tongji_bak opt]# smbpasswd -a smbuser1
New SMB password:
Retype new SMB password:
Added user smbuser1.
[root@tongji_bak opt]#
添加的samba用户都是在OS的一个文件当中,我们可以通过以下命令查看
[root@tongji_bak opt]# more /etc/samba/passdb.tdb
TDB file
ser1
smbuser1
使用smbuser1用户登录,访问samba服务器