Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!
Labels (2)
avatar
Rising Star

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:

https://docs.hortonworks.com/HDPDocuments/Ambari-2.5.0.3/bk_ambari-administration/content/create_use...

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.

1,775 Views
0 Kudos
Version history
Last update:
‎07-13-2017 01:48 PM
Updated by:
Contributors