blob: db0c1e0eb25a38f611b8dd1c5d3f188c2b34fc0b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/bin/sh
default_priv_quota=50G
default_pub_quota=10G
# Format: username:privquota:pubquota. For example:
# nfs_homedirs='joe:250G:10G jane:250G'
# nfs_groupdirs='sysadmins:250G doefamily:100G:10G'
# Create user home directories.
for userquota in ${nfs_homedirs:-}; do
user=$(echo "$userquota" | awk -F: '{print $1}')
privquota=$(echo "$userquota" | awk -F: '{print $2}')
pubquota=$(echo "$userquota" | awk -F: '{print $3}')
create_dataset -p "${nfs_dataset}/user/${user}/priv"
create_dataset -p "${nfs_dataset}/user/${user}/pub"
zfs set "refquota=${privquota:-$default_priv_quota}" "${nfs_dataset}/user/${user}/priv"
zfs set "refquota=${pubquota:-$default_pub_quota}" "${nfs_dataset}/user/${user}/pub"
zfs set 'com.sun:auto-snapshot=true' \
"${nfs_dataset}/user/${user}/priv" \
"${nfs_dataset}/user/${user}/pub"
chown "${user}:${user}" \
"${nfs_root}/user/${user}/priv" \
"${nfs_root}/user/${user}/pub"
chmod 700 "${nfs_root}/user/${user}/priv"
chmod 755 "${nfs_root}/user/${user}/pub"
done
# Create group home directories.
for groupquota in ${nfs_groupdirs:-}; do
group=$(echo "$groupquota" | awk -F: '{print $1}')
privquota=$(echo "$groupquota" | awk -F: '{print $2}')
pubquota=$(echo "$groupquota" | awk -F: '{print $3}')
create_dataset -p "${nfs_dataset}/group/${group}/priv"
create_dataset -p "${nfs_dataset}/group/${group}/pub"
zfs set "refquota=${privquota:-$default_priv_quota}" "${nfs_dataset}/group/${group}/priv"
zfs set "refquota=${pubquota:-$default_pub_quota}" "${nfs_dataset}/group/${group}/pub"
zfs set 'com.sun:auto-snapshot=true' \
"${nfs_dataset}/group/${group}/priv" \
"${nfs_dataset}/group/${group}/pub"
chown "root:${group}" \
"${nfs_root}/group/${group}/priv" \
"${nfs_root}/group/${group}/pub"
chmod 770 "${nfs_root}/group/${group}/priv"
chmod 775 "${nfs_root}/group/${group}/pub"
for sub in priv pub; do
set_facl "${nfs_root}/group/${group}/${sub}" \
group:${group}:rwpDdaARWcs:fd:allow \
group:${group}:x:d:allow
done
done
|