Skip to content

Instantly share code, notes, and snippets.

@pavlov99
Created October 23, 2015 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavlov99/a9af5871a1db578de16e to your computer and use it in GitHub Desktop.
Save pavlov99/a9af5871a1db578de16e to your computer and use it in GitHub Desktop.
create user directory in hadoop
The /user/ directory is owned by "hdfs" with 755 permissions. As a result only hdfs can write to that directory. Unlike unix/linux, hdfs is the superuser and not root. So you would need to do this:
sudo -u hdfs hadoop fs -mkdir /user/,,myfile,,
sudo -u hdfs hadoop fs -put myfile.txt /user/,,/,,
If you want to create a home directory for root so you can store files in his directory, do:
sudo -u hdfs hadoop fs -mkdir /user/root
sudo -u hdfs hadoop fs -chown root /user/root
Then as root you can do "hadoop fs -put file /user/root/".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment