diff options
author | Cullum Smith <cullum@sacredheartsc.com> | 2024-10-21 09:17:49 -0400 |
---|---|---|
committer | Cullum Smith <cullum@sacredheartsc.com> | 2024-10-21 09:17:49 -0400 |
commit | 8e3d7dfa20b966b928078d8071d10fb186a0d781 (patch) | |
tree | 60a2a98dd6ae9148d1cf4b8d2f3ec53b9bab41c1 /scripts/hostname/nfs1/10-homedirs | |
parent | 18e46bcafc2316c53d167cf6550fb69bd4e3be79 (diff) | |
download | infrastructure-8e3d7dfa20b966b928078d8071d10fb186a0d781.tar.gz |
cleanup nfs1 host script
Diffstat (limited to 'scripts/hostname/nfs1/10-homedirs')
-rw-r--r-- | scripts/hostname/nfs1/10-homedirs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/scripts/hostname/nfs1/10-homedirs b/scripts/hostname/nfs1/10-homedirs new file mode 100644 index 0000000..f2cd25c --- /dev/null +++ b/scripts/hostname/nfs1/10-homedirs @@ -0,0 +1,50 @@ +#!/bin/sh + +default_priv_quota=250G +default_pub_quota=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" + + 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" + + 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 |