Support Questions

Find answers, ask questions, and share your expertise

Creating new user and allocating space

avatar
Explorer

Hi,

I started a Hortonworks Cloud Cluster using the AWS Marketplace and CloudFormation. I logged in as "admin" and created a new account, but that account does not have a /user/<username> in Files View of Ambari. How do I allocate and provision a file folder for that new user?

Thanks!

1 ACCEPTED SOLUTION

avatar
Super Collaborator

From the command line as the hdfs user:

# Create the directory

$ hdfs dfs -mkdir /user/<username>

# Set permissions and ownership

$ hdfs dfs -chown <username> /user/<username>

$ hdfs dfs -chmod 700 /user/<username>

##Optionally set

$ hdfs dfsadmin -setSpaceQuota <bytes_allocated> /user/<username>

## Where bytes_allocated is bytes allowed for this directory (counting replication). This is allocating space for the directory, not by username. So if the user created files in other HDFS directories, this doesn't control that.

View solution in original post

6 REPLIES 6

avatar
Super Collaborator

From the command line as the hdfs user:

# Create the directory

$ hdfs dfs -mkdir /user/<username>

# Set permissions and ownership

$ hdfs dfs -chown <username> /user/<username>

$ hdfs dfs -chmod 700 /user/<username>

##Optionally set

$ hdfs dfsadmin -setSpaceQuota <bytes_allocated> /user/<username>

## Where bytes_allocated is bytes allowed for this directory (counting replication). This is allocating space for the directory, not by username. So if the user created files in other HDFS directories, this doesn't control that.

avatar
Super Collaborator
@Venkat Rangan

I'm sorry, but at the moment I don't know how to execute commands as hdfs in cloudbreak, but maybe - the cloudbreak user *may* be able to sudo (sudo -u hdfs <COMMAND>). If you are not familiar with sudo, do it something like this:

sudo -u hdfs hdfs dfs -mkdir /user/<username>

Don't let the "hdfs hdfs" together confuse you. The first one is the username and the second one is the command.

Give that a shot and let me know.

avatar
Super Collaborator

@Venkat Rangan - I think I found the documentation you need to become the admin user:

As the default "cloudbreak" user doesn't have certain permissions (for example, it has no write access to HDFS), you must use the "admin" user to perform certain actions. To use the "admin" user instead of the default "cloudbreak" user, run sudo su - admin.

(http://docs.hortonworks.com/HDPDocuments/HDCloudAWS/HDCloudAWS-1.8.0/bk_hdcloud-aws/content/using/index.html)

avatar
Explorer

James,

Thanks very much for your response. Now, when I ssh, I can only enter as "cloudbreak" user. After getting to the box, I tried:

su hdfs

and that failed to login with "su: Authentication failure". So, how do I first setup the hdfs user?

Thanks!

avatar
Explorer

Yes - adding a "sudo -u hdfs" to all the commands worked. Accepting your answer. Thanks again.

avatar
Super Collaborator

Awesome. Good luck.