post-user-creation-hook.sh - Adding HDFS quotas
When using post-user-creation-hook.sh script to create home directories for users we can edit the script to set a quota too.
For information on enabling HDFS home dir creation see:
If you want to set a quota on this dir you can edit:
/var/lib/ambari-server/resources/scripts/post-user-creation-hook.sh
# the default implementation creates user home folders; the first argument must be the username
ambari_sudo "yarn jar /var/lib/ambari-server/resources/stacks/HDP/2.0.6/hooks/before-START/files/fast-hdfs-resource.jar $JSON_INPUT"
#ADD THESE LINES
while read -r LINE
do
USR_NAME=$(echo "$LINE" | awk -F, '{print $1}')
hdfs dfsadmin -setSpaceQuota 10 /user/$USR_NAME > /tmp/posthook.tmp
done <"$CSV_FILE"
#END ADD QUOTA
if [ "$DEBUG" -gt "0" ]; then echo "Switch debug OFF";set -x;unset DEBUG; else echo "debug: OFF"; fi
unset DEBUG
}
main "$@"
Add the lines between the comments and save. Now when a user is added both a home dir is created with a 10G quota set.

