天天看點

samba伺服器配置

1 samba服務搭建環境

server端:

CentOS release 6.8 (Final)

ip 192.168.91.3

hostname:Darren

client端:

windows 7

2 server端安裝smbd服務

[root@Darren ~]# yum -y install samba

[root@Darren vsftpd]# rpm -qa |grep samba

samba-winbind-clients-3.6.23-36.el6_8.x86_64

samba-3.6.23-36.el6_8.x86_64

samba-client-3.6.23-36.el6_8.x86_64

samba-winbind-3.6.23-36.el6_8.x86_64

samba-common-3.6.23-36.el6_8.x86_64

[root@Darren init.d]# /etc/init.d/smb restart

[root@Darren init.d]# netstat -nltup|grep smbd

tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN      33185/smbd         

tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      33185/smbd         

tcp        0      0 :::445                      :::*                        LISTEN      33185/smbd         

tcp        0      0 :::139                      :::*                        LISTEN      33185/smbd         

[root@Darren init.d]# ps -ef|grep smbd

root      33185      1  0 21:41 ?        00:00:00 smbd -D

root      33187  33185  0 21:41 ?        00:00:00 smbd -D

root      33251  26115  0 21:43 pts/0    00:00:00 grep smbd

[root@Darren init.d]# chkconfig --level 2345 smb on

3 設定samba主要配置檔案

(1)通路方式為share

配置檔案添加如下:

[root@Darren samba]# vim /etc/samba/smb.conf

[global]

        security = share   -- 通路的方式,share不需要密碼,user需要使用者名和密碼

[public]

        comment = Public Stuff

        path = /home/samba

         writeable = yes

        write list = +staff

        read only = No

        guest ok = Yes

建立共享檔案

[root@Darren samba]# mkdir /home/samba^C

測試:在windows檔案夾中輸入

\\192.168.91.3\

可以看到public檔案夾

(2)通路方式為user

        security = user   

#把使用者user3添加到samba中,并設定通路密碼,這個密碼和user3在linux使用者中密碼可以不一樣

[root@Darren samba]# smbpasswd -a user3

New SMB password:

Retype new SMB password:

Added user user3.

#重新開機smb服務:

[root@Darren samba]# /etc/init.d/smb restart

測試在windows檔案夾中輸入

輸入使用者user3和密碼即可通路共享檔案夾,除了可以看到public檔案夾外,預設還會看到user3檔案夾(指向linux中user3使用者的家目錄)

本文轉自 Darren_Chen 51CTO部落格,原文連結:http://blog.51cto.com/darrenmemos/1873667,如需轉載請自行聯系原作者

繼續閱讀