Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to create user home directory [/user/${user_name}/] automatically in HDFS after user logs in to the cluster using AD/Kerberos

avatar
Contributor
 
1 ACCEPTED SOLUTION

avatar
Master Mentor

@D Giri

Please refer to the following doc:

Enable User Home Directory Creation:

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

By editing the "/etc/ambari-server/conf/ambari-properties" and adding the following:

ambari.post.user.creation.hook=/var/lib/ambari-server/resources/scripts/post-user-creation-hook.sh

.

For kerberized environment you must modify the kinit file path in the default user creation hook script.

/var/lib/ambari-server/resources/scripts/post-user-creation-hook.sh

.

View solution in original post

7 REPLIES 7

avatar
Master Mentor

@D Giri

Please refer to the following doc:

Enable User Home Directory Creation:

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

By editing the "/etc/ambari-server/conf/ambari-properties" and adding the following:

ambari.post.user.creation.hook=/var/lib/ambari-server/resources/scripts/post-user-creation-hook.sh

.

For kerberized environment you must modify the kinit file path in the default user creation hook script.

/var/lib/ambari-server/resources/scripts/post-user-creation-hook.sh

.

avatar
Contributor

Thanks Jay SenSharma for sharing the link.

avatar

@Jay Kumar SenSharma

Hi Jay ,

if group is being sync with ambari from ldap in this case will the directory be created for the all the members in the group ?

avatar
Super Collaborator

and don't forget to add:

ambari.post.user.creation.hook.enabled=true

to "/etc/ambari-server/conf/ambari-properties" as well !!

avatar
New Contributor

Hello jay,

May i know how to know default kinit file location?

and

my cluster is kerberized can you tell me what was the parameter in the post-user-creation-hook.sh script specifies the kinit file path?

Regards,

Venkatesh.

avatar
Super Collaborator

@Ramisetty Venkatesh

its easy, just execute

which kinit

on Nix and the output is what should go into the hook script part at:

echo "The cluster is secure, calling kinit ..."
  kinit_cmd="/usr/bin/kinit -kt $HDFS_KEYTAB $HDFS_PRINCIPAL"

But 9 times ou of 10 /usr/bin/kinit will be just fine

avatar
New Contributor

Hello Jasper/Jay,

I have tried all the steps mentioned above. But user home directory was not getting created when user logs on to HDFS for first time.

The newly created user directories are getting created only after running LDAP Sync Script and followed by ambari server service restart.

We cannot perform Ambari server service restart every time when user gets created in environment. So please suggest When this hook script is getting called and executed?

and remedy for this issue.

Regards,

venkatesh.