Support Questions

Find answers, ask questions, and share your expertise

Is it possible to change the default "home" directory (i.e. /user/${USER})?

avatar
 
1 ACCEPTED SOLUTION

avatar

@Sean Roberts As noted above, this is controlled by the 'dfs.user.home.dir.prefix' parameter in hdfs-site.xml. However, since this is not a commonly changed parameter, it isn't in the default Ambari configs for HDFS. (It just defaults to the value from hdfs-default.xml.)

To change this value in Ambari, do the following:

  • In Ambari, select the HDFS service, then select the "Configs" tab.
  • Within Configs, select the "Advanced" tab
  • Open the "Advanced hdfs-site" section, and confirm that this parameter isn't already present there.
  • Open the "Custom hdfs-site" section, and click the "Add property" link
  • A dialogue pops up, inviting you to type a "key=value" pair in the text field. Enter:
    dfs.user.home.dir.prefix=/user
  • Press the "Add" button, and the new entry will be converted into a standard parameter entry field.
  • Now change the value of the field to whatever you want (no blank spaces in the path, please).
  • Of course after changing configurations, you have to press the "Save" button at the top of the window.

That should do what you need, I hope.

View solution in original post

6 REPLIES 6

avatar

@Sean Roberts

As per the link: https://hadoop.apache.org/docs/r2.6.0/hadoop-project-dist/hadoop-hdfs/hdfs-default.xml

dfs.user.home.dir.prefix   =   /user
The directory to prepend to user name to get the user's home direcotry.

.

avatar

@Sean Roberts

You can try setting that property "dfs.user.home.dir.prefix" to "hive-site.xml". Is there any specific reason you want to change it?

From command line we can get it's value as

$ hdfs getconf -confKey dfs.user.home.dir.prefix

. I have not tried changing the default "/user" directory of HDFS though.

avatar

@Sean Roberts As noted above, this is controlled by the 'dfs.user.home.dir.prefix' parameter in hdfs-site.xml. However, since this is not a commonly changed parameter, it isn't in the default Ambari configs for HDFS. (It just defaults to the value from hdfs-default.xml.)

To change this value in Ambari, do the following:

  • In Ambari, select the HDFS service, then select the "Configs" tab.
  • Within Configs, select the "Advanced" tab
  • Open the "Advanced hdfs-site" section, and confirm that this parameter isn't already present there.
  • Open the "Custom hdfs-site" section, and click the "Add property" link
  • A dialogue pops up, inviting you to type a "key=value" pair in the text field. Enter:
    dfs.user.home.dir.prefix=/user
  • Press the "Add" button, and the new entry will be converted into a standard parameter entry field.
  • Now change the value of the field to whatever you want (no blank spaces in the path, please).
  • Of course after changing configurations, you have to press the "Save" button at the top of the window.

That should do what you need, I hope.

avatar

As usual, parameter changes only affect things going forward. If users have already been created in the default location, their home directories will not be magically re-created in the new location. This could cause problems, depending on whether processes use the parameter vs using hardwired "/user" prefix. For your site-defined users, you can just move their home directories with dfs commands. For the pre-defined Stack service users, you'll need to experiment to see whether they want their home directories to stay in /user or be moved to value(dfs.user.home.dir.prefix). I would start by leaving them in place, but that's just a guess.

avatar

One way to see whether any Stack services use hardwired "/user" prefix would be to use Ambari to install the whole Stack on a lab machine. Make a change to "dfs.user.home.dir.prefix", to something other than "/user", during Install Wizard time, BEFORE letting Ambari do the actual installation, thus making sure everything from the beginning sees the non-default value. Let it install, start all the services and let them run a few minutes, then see if anything got created under /user/* in HDFS. Sorry I don't have time to do the experiment right now, but if you do please report the results back here as a comment for others to learn from. If you find services that apparently hardwire the "/user" prefix, I'll enter bugs against those components and try to get them fixed.

avatar

@Matt Foley - Does HDFS have home references such as ~ or ${HOME} ?