Samba 企业应用案例需求:
1. 所有员工都能够在公司内流动办公,但不管在哪电脑上工作,都要把自己文件存在 Samba 文件服器上.
2. 各部门办公人员拥有各自的主目录,用于存放私有文档(工作相关),其他人禁止访问.
3. 所有的用户都不允许使用服务器的 SHELL(安全考虑).
4. 制造部、财务部、管理部,都有各自的文件目录.
5. 各部门目录下提供“对外”、“公共文档”、“受控文档”三个子目录.
对外: <1>允许公司所有工作人员访问,但不能修改文件.
<2>本部门文员负责维护数据
公共文档:<1>本部门员工可以访问,领导层可以访问,但不能修改.
<2> 本部门文员负责维护数据
受控文档:<1>本部门主管、公司领导可以访问、其他员工禁止.
<2>本部门主管负责维护数据
注:财务部受控文档只允许总经理、财务部总监、主管访问;管理部受控文档只允许总经理、主管访问
6. 公共区域:<1>所有员工均可访问
<2>网络部负责维护
7. 交换区域:<1>所有员工均可读可写,禁止删除其它员工文件.
2>网络部负责维护
创建相关的目录:
mdkir /home/samba/zhizao caiwu guanli public swap
mkdir /home/samba/zhizao/guest public private
mkdir /home/samba/caiwu/guest public private
mkdir /home/samba/guanli/guest public private
创建相关的用户和组:
groupadd zhizao caiwu guanli lingdao network
useradd s /bin/false wy zg zj jl
usermod G zhizao,caiwu,guanli wy
usermod G zhizao,caiwu,guanli zg
usermod G caiwu zj
usermod G lingdao jl
设置文件系统权限:
chmod 1777 /home/samba/swap
chmod 755 /home/samba/zhizao caiwu guanli
chmod 775 /home/samba/public
chgrp network /home/samba/public
chmod 755 /home/samba/zhizao/guest
chown wy.zhizao /home/samba/zhizao/guest
chmod 750 /home/samba/zhizao/public private
chown zg.lingdao /home/samba/zhizao/private
setfacl m g:lingdao:rx /home/samba/zhizao/public
chmod 755 /home/samba/caiwu/guest
chown wy.caiwu /home/samba/caiwu/guest/guest
chmod 750 /home/samba/caiwu/public
chown wy.caiwu /home/samba/caiwu/public
setfacl m g:lingdao:rx /home/samba/caiwu/public
chmod 700 /home/samba/caiwu/private
chown zg /home/samba/caiwu/private
setfacl m u:zj:rx /home/samba/caiwu/private
setfacl m u:jl:rx /home/samba/caiwu/private
chmod 755 /home/samba/guanli/guest
chown wy.guanli /home/samba/guanli/guest
chmod 750 /home/samba/guanli/public
chown wy.guanli /home/samba/guanli/public
setfacl m g:lingdao:rx /home/samba/guanli/public
chmod 700 /home/samba/guanli/private
chown zg /home/samba/guanli/private
setfacl m u:jl:rx /home/samba/guanli/private
配置 samba 服务:
[homes]
comment = Home Directories
browseable = no
writable = yes
[制造部]
path = /home/samba/zhizao
writable = yes
browseable = yes
[对外]
path = /home/samba/zhizao/guest
admin users = wy
browseable = no
[公共文档]
path = /home/samba/zhizao/public
valid users = @zhizao @lingdao
admin users = wy
browseable = no
[受控文档]
path = /home/samba/zhizao/private
valid users = zg @lingdao
admin users = zg
browseable = no
[财务部]
path = /home/samba/caiwu
writable = yes
browseable = yes
[对外]
path = /home/samba/caiwu/guest
admin users = wy
browseable = no
[公共文档]
path = /home/samba/caiwu/public
valid users = @caiwu @lingdao
admin users = wy
browseable = no
[受控文档]
path = /home/samba/caiwu/private
valid users = zg zj jl
admin users = zg
browseable = no
[管理部]
path = /home/samba/guanli
writable = yes
browseable = yes
[对外]
path = /home/samba/guanli/guest
admin users = wy
browseable = no
[公共文档]
path = /home/samba/guanli/public
valid users = @guanli @lingdao
admin users = wy
browseable = no
[受控文档]
path = /home/samba/guanli/private
valid users = zg jl
admin users = zg
browseable = no
[公共区域]
path = /home/samba/public
public = yes
admin users = @network
[交换区域]
path = /home/samba/swap
writeable = yes
public = yes
admin users = @network