LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1554|回复: 8

samba 如何控制共享目录,用户写入文件大小

[复制链接]
发表于 2005-11-20 13:57:03 | 显示全部楼层 |阅读模式
我建了一个,samba 服务器,设了一些,共享目录,硬盘是40G的,总是被写入很大的文件,我想控制它,让有权力用户,写入文件大小不超过5m  可是在samba里我不知道怎么能做到,
我用的redhat 9.0 版自带samba
发表于 2005-11-21 01:10:24 | 显示全部楼层
smb.conf帮助里边拷下来的。不知道是否用的上。

set quota command (G)
              The set quota command should only be used whenever there is no operating system API available from the OS that samba can use.

              This  option is only available if Samba was configured with the argument --with-sys-quotas or on linux when ./configure --with-quotas
              was used and a working quota api was found in the system. Most packages are configured with these options already.

              This parameter should specify the path to a script that can set quota for the specified arguments.

              The specified script should take the following arguments:

                1 - quota type

                   1 - user quotas

                   2 - user default quotas (uid = -1)

                   3 - group quotas

                   4 - group default quotas (gid = -1)

                2 - id (uid for user, gid for group, -1 if N/A)

                3 - quota state (0 = disable, 1 = enable, 2 = enable and enforce)

                4 - block softlimit

                5 - block hardlimit

                6 - inode softlimit

                7 - inode hardlimit

                8(optional) - block size, defaults to 1024

              The script should output at least one line of data on success. And nothing on failure.

              Default: set quota command =

              Example: set quota command = /usr/local/sbin/set_quota
回复 支持 反对

使用道具 举报

发表于 2005-11-21 08:34:16 | 显示全部楼层
请问一下 这个specified script 怎么写??
格式不知道。。上面旧说要写的参数
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-21 17:51:13 | 显示全部楼层
我是E 盲 用词霸看了这个  set quota command (G)
连猜带蒙,明白一点,SAMBA 是通过LINUX 系统的磁盘
配额,对用户写入文件进行限制,
LINUX 的磁盘配额能限制指定用户写入文件的大小和数量
但我 不明白SAMBA 在其中的作用


Default: set quota command =

Example: set quota command = /usr/local/sbin/set_quota

上面的这俩行是SAMBA 调用磁盘配额的角本么?  是不是SAMBA 本身没
有这样的功能,当有用户写入文件,它只是调用下LINUX 本身的配额角本
来起到限制作用       那不是没什么必要么? 只接用磁盘配额功能不就得了
回复 支持 反对

使用道具 举报

发表于 2005-11-21 18:16:51 | 显示全部楼层
ulimit就可以限制文件大小吧?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-21 18:40:32 | 显示全部楼层
ulimit 是做什么的?SAMBA 里的么? 怎么用啊? 有资料么? 谢谢
回复 支持 反对

使用道具 举报

发表于 2005-11-22 00:49:38 | 显示全部楼层
# ulimit -a
core file size        (blocks, -c) 0
data seg size         (kbytes, -d) unlimited
file size             (blocks, -f) unlimited
max locked memory     (kbytes, -l) 32
max memory size       (kbytes, -m) unlimited
open files                    (-n) 1024
pipe size          (512 bytes, -p) 8
stack size            (kbytes, -s) 8192
cpu time             (seconds, -t) unlimited
max user processes            (-u) 40960
virtual memory        (kbytes, -v) unlimited

跟文件没关系的。:)。

至于那个磁盘配额,我没用过,不清楚。也许是让你有更多的方法来完成这个工作?
回复 支持 反对

使用道具 举报

发表于 2005-11-22 11:18:11 | 显示全部楼层
Post by AppleKnife
我是E 盲 用词霸看了这个  set quota command (G)
连猜带蒙,明白一点,SAMBA 是通过LINUX 系统的磁盘
配额,对用户写入文件进行限制,
LINUX 的磁盘配额能限制指定用户写入文件的大小和数量
但我 不明白SAMBA 在其中的作用


Default: set quota command =

Example: set quota command = /usr/local/sbin/set_quota

上面的这俩行是SAMBA 调用磁盘配额的角本么?  是不是SAMBA 本身没
有这样的功能,当有用户写入文件,它只是调用下LINUX 本身的配额角本
来起到限制作用       那不是没什么必要么? 只接用磁盘配额功能不就得了

从MAN上来看 就是set quota command = /usr/local/sbin/set_quota
然后编辑/usr/local/sbin/set_quota 这个文件 但是man上没说这个文件的格式吧
回复 支持 反对

使用道具 举报

发表于 2005-11-22 11:51:02 | 显示全部楼层
告诉了3个入口参数。然后你自己去写这个脚本。:)。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表