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]
Created on 05-04-2020 04:45 AM - edited 09-16-2022 07:36 AM
I'm using CDH 6.3.2. When trying to create directories in hdfs, I'm having permission denied like this one:
[devuser@master01 ~]$ hdfs dfs -mkdir /dev
mkdir: Permission denied: user=devuser, access=WRITE, inode="/":hdfs:supergroup:drwxr-xr-x
How can I add my user on hdfs? and how can my user run jobs as well?
Created on 05-04-2020 05:34 AM - edited 05-04-2020 05:41 AM
Hi, Mondi!
The msg you are getting is telling that user devuser does not have permission to write to the root (/) HDFS folder. This is normal, and just like a Linux FS. If you create a folder in HDFS and make your local unix account the owner, you can use that folder as you.
If you want to create objects in hdfs /, you need to become the superuser, hdfs. Example:
# create your folder
$ sudo -u hdfs hdfs dfs -mkdir /user/devuser
# make devuser the owner:
$ sudo -u hdfs hdfs -chown devuser /user/devuser
You first elevate to hdfs, then run the hdfs dfs command. This wil create your personal directory in /user and make you the owner. Now, when you run hdfs commands as devuser, you will have permission to modify objects in that folder.
CAREFUL: elevating to hdfs is like becoming root in linux. You can do a lot of damage if you make a mistake.
Created on 05-05-2020 01:22 AM - edited 05-05-2020 01:34 AM
just update dfs.cluster.administrators with the admin username you want in hdfs config (and restart hdfs,yarn,MR2,... services)
ex: dfs.cluster.administrators = hdfs,ops
you can also use a HDFS administrators group (only one administrator group) using dfs.permissions.superusergroup
ex : dfs.permissions.superusergroup = operations
to verify config has been updated, once services restarted
hdfs getconf -confKey dfs.cluster.administrators
or
hdfs getconf -confKey dfs.permissions.superusergroup
Created on 05-04-2020 05:34 AM - edited 05-04-2020 05:41 AM
Hi, Mondi!
The msg you are getting is telling that user devuser does not have permission to write to the root (/) HDFS folder. This is normal, and just like a Linux FS. If you create a folder in HDFS and make your local unix account the owner, you can use that folder as you.
If you want to create objects in hdfs /, you need to become the superuser, hdfs. Example:
# create your folder
$ sudo -u hdfs hdfs dfs -mkdir /user/devuser
# make devuser the owner:
$ sudo -u hdfs hdfs -chown devuser /user/devuser
You first elevate to hdfs, then run the hdfs dfs command. This wil create your personal directory in /user and make you the owner. Now, when you run hdfs commands as devuser, you will have permission to modify objects in that folder.
CAREFUL: elevating to hdfs is like becoming root in linux. You can do a lot of damage if you make a mistake.
Created 05-04-2020 07:41 PM
Hi @hughatoclc thanks for this. this is a big help. however, how can I make my user also in hdfs supergroup? so that I can freely explore the hdfs and also can I run jobs using this as well?
Created on 05-05-2020 01:22 AM - edited 05-05-2020 01:34 AM
just update dfs.cluster.administrators with the admin username you want in hdfs config (and restart hdfs,yarn,MR2,... services)
ex: dfs.cluster.administrators = hdfs,ops
you can also use a HDFS administrators group (only one administrator group) using dfs.permissions.superusergroup
ex : dfs.permissions.superusergroup = operations
to verify config has been updated, once services restarted
hdfs getconf -confKey dfs.cluster.administrators
or
hdfs getconf -confKey dfs.permissions.superusergroup