灵活使用ACL设置samba的共享权限(user1可读写,user2可读不可写,user3可写不可读,user4只能看到共享!)

来源:互联网 发布:java工作流引擎干嘛的 编辑:程序博客网 时间:2024/05/05 22:43

1,  编辑samba的配置文件(vim /etc/samba/smb.conf

以共享jh目录为例!

jh

   Comment = jh

   Path = /jh

   Writable = yes

   Create mask = 1606

   Directory mask = 1606

   Read list = user2

2,让Linux支持POSIX ACL (这个 POSIX ACL 的功能在 Linux kernel 2.6 上被正式支持,之后又被 back-port
 2.4 kernel 上。大家常用的档案系统,如:ext3xfsjfs,和 ReiserFS,都能使用 ACL。当然,大家须要在编译 kernel 时启动 ACL)

编辑/etc/fstab

添加一行:

/dev/sda1      /home           ext3        acl              1  2

重启!

3,  编一个小脚本

 #!/bin/bash

 Mkdir jh

 Chmod 077 /jh

 Chown user4.user4 /jh

 Chmod o+t /jh

 Setfacl  –m d:u:user1:rwx  /jh

 Setfacl  –m d:u:user2:r   /jh

 Setfacl   -m d:u:user3:w  /jh

最后运行脚本,重启smb即可!

记住防火墙要关哦!!!

如果对POSIX ACL 有兴趣请看:http://jianghuo495593541.download.csdn.net

 

   

原创粉丝点击