0
环境
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# nl /etc/issue
1 CentOS release 6.5 (Final)
2 Kernel \r on an \m
1
建5用户vbirdN,这个是从鸟哥那借的
[root@hostalonetest ~]# vi au.sh
#!/bin/bash
groupadd vbirdgroup
for username in vbird1 vbird2 vbird3 vbird4 vbird5
do
useradd -G vbirdgroup $username
echo "password" | passwd --stdin $username
done
[root@hostalonetest ~]# sh au.sh
Changing password for user vbird1.
passwd: all authentication tokens updated successfully.
Changing password for user vbird2.
passwd: all authentication tokens updated successfully.
Changing password for user vbird3.
passwd: all authentication tokens updated successfully.
Changing password for user vbird4.
passwd: all authentication tokens updated successfully.
Changing password for user vbird5.
passwd: all authentication tokens updated successfully.
1 #
2 # /etc/fstab
3 # Created by anaconda on Tue Dec 2 18:52:50 2014
4 #
5 # Accessible filesystems, by reference, are maintained under ‘/dev/disk‘
6 # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
7 #
8 UUID=93cd7207-78c4-4a95-be1b-7451772c21ad / ext4 defaults 1 1
9 UUID=9a982f8d-d590-49f2-9cf1-e07a5b8238dd /boot ext4 defaults 1 2
10 UUID=c8939b59-9a73-45fa-bd5a-f016a5aa631e /home ext4 defaults,usrquota,grpquota 1 2
11 UUID=1f3d9eaf-e140-47ab-ae99-fcf1516d2070 swap swap defaults 0 0
12 tmpfs /dev/shm tmpfs defaults 0 0
13 devpts /dev/pts devpts gid=5,mode=620 0 0
14 sysfs /sys sysfs defaults 0 0
15 proc /proc proc defaults 0 0
6
卸载、加载/home,并查看/home项
[root@localhost ~]# umount /home/; mount -a
[root@localhost ~]# mount | grep home
/dev/sda3 on /home type ext4 (rw,usrquota,grpquota)
7
quotacheck生成配额文件,结果如下
[root@localhost ~]# qutoacheck -avug
-bash: qutoacheck: command not found
[root@localhost ~]#
9
开启限制,生成用户和组限制文件
[root@localhost ~]# quotacheck -avug
quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.
quotacheck: Scanning /dev/sda3 [/home] done
quotacheck: Cannot stat old user quota file /home/aquota.user: No such file or directory. Usage will not be substracted.
quotacheck: Cannot stat old group quota file /home/aquota.group: No such file or directory. Usage will not be substracted.
quotacheck: Cannot stat old user quota file /home/aquota.user: No such file or directory. Usage will not be substracted.
quotacheck: Cannot stat old group quota file /home/aquota.group: No such file or directory. Usage will not be substracted.
quotacheck: Checked 33 directories and 18 files
quotacheck: Old file not found.
quotacheck: Old file not found.
[root@localhost ~]# quotaon -avug
/dev/sda3 [/home]: group quotas turned on
/dev/sda3 [/home]: user quotas turned on
10
增加配额限制
[root@localhost ~]# edquota -u vbird1
Disk quotas for user vbird1 (uid 501):
Filesystem blocks soft hard inodes soft hard
/dev/sda3 32 8000 10000 8 0 0
单位是KB
[root@localhost ~]# edquota -u vbird2
。。。