quota+samba實現共享配額

 一、檢查quota是否安裝:

[root@localhost ~]# rpm -qa | grep quota 

quota-3.13-1.2.5.el5



二、檢查、配置磁盤掛載選項

1.配置quota前

[root@localhost ~]# cat /etc/fstab |grep sdc

UUID="d6c99ad6-0c55-46e8-b9ac-68e19c3c3c12"  /sdc  ext2 defaults        1 1

[root@localhost ~]#  mount |grep /dev/sdc

/dev/sdc on /sdc type ext2 (rw)


2.修改quota配置

[root@localhost ~]# cat /etc/fstab |grep sdc

UUID="d6c99ad6-0c55-46e8-b9ac-68e19c3c3c12"  /sdc  ext2 defaults,usrquota,grpquota       1 1

[root@localhost ~]# umount /dev/sdc

[root@localhost ~]# mount -a (無報錯即可成功掛載。)

[root@localhost ~]# mount |grep /sdc 

/dev/sdc on /sdc type ext2 (rw,usrquota,grpquota)



三、創建用戶、組,配置磁盤限額

1.創建用戶、組

[root@localhost ~]# groupadd share

[root@localhost ~]# useradd user1 -g share


2.創建配額文件

[root@localhost sdc]# quotacheck -cumg /sdc    

[root@localhost sdc]# ls

aquota.group  aquota.user  lost+found


3.創建用戶配額

shell命令創建

[root@localhost sdc]# setquota -u user1  102400  102400  0  0  /sdc

軟限制容量50M,硬限制100M,限制300個文件、目錄,

edquota創建(類似vi)

[root@localhost sdc]# edquota -u user1

Disk quotas for user user1 (uid 500):

  Filesystem                   blocks       soft       hard     inodes     soft     hard

  /dev/sdc                          0       102400      102400          0      300      500


4.開啓配額

[root@localhost sdc]# quotaon -avug

/dev/sdc [/sdc]: group quotas turned on

/dev/sdc [/sdc]: user quotas turned on



四、smb配置

[root@localhost samba]# tail smb.conf

;       writable = yes

;       printable = no

;       write list = +staff

[sdc]

       comment = sdc

       path = /sdc/share

       public = no

       writable = yes

       guest ok = no

       valid users = user1 

五、驗證

    ①在windows上映射磁盤,顯示分區爲100M

wKioL1e1rl3TAF67AAAVqCxZiMo240.png-wh_50


    ②在Linux上掛載,顯示爲共享磁盤的原始容量。

     但是測試往磁盤寫200M數據,只能成功寫入100M。

wKiom1e1sJqT3gfuAAB3c40Vf10349.png-wh_50


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章