4.1、Yum –y install samba-*
安装samba服务包
[root@localhostyum.repos.d]# rpm -qa | grep samba
samba-swat-3.0.33-3.28.el5
samba-common-3.0.33-3.28.el5
samba-3.0.33-3.28.el5
samba-client-3.0.33-3.28.el5
4.2、修改主配置文件
背景需求:
1、建立HR部门的共享文件夹,目录为/HR
2、分配权限为HR部门可写,财务经理可写,财务部可读
Vim/etc/samba/smb.conf
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
security = user
passdb backend = tdbsam
load printers = yes
cups options = raw
[homes]
comment = Home Directories
browseable = no
writable = yes
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
[HR] ;新建一共享目录HR
comment ="HR using" 注释目录用途
path = /HR 共享目录路径
public = no 是否允许来宾访问
writable =yes 写的权限
write list =@HR caiwujingli 用户写入权限的用户列表或者组列表
valid user =@HR caiwu 有效的用户分别是HR组成员和caiwu用户
read only =yes 开启只读权限
read list =@HR caiwu 拥有读权限的用户列表
printable =no 是否可打印
browseables = no 是否可见
4.3、启用服务
/etc/init.d/smbstart
客户端访问
Windows客户端访问
\\192.168.1.100\HR 服务器ip地址\目录名称
Linux客户端访问
Smbclient –L//serverip -------------客户端查看共享
Smbclient //serverip/路径 -U 用户---------------客户端下载目录内的内容