Search code examples
hdfs

unable to create directory in hdfs - permission denied error


i am trying to create a directory for the user tom in hdfs and i get the following error related to permission. Please let me know how to resolve this.

hdfs dfs -mkdir /user/tom /
mkdir: Permission denied: user=tom, access=WRITE, inode="/user":hdfs:supergroup:drwxr-xr-x

Kindly help.

Thanks, Ram


Solution

  • The HDFS approach to file permissions is very similar to the POSIX approach used in Linux systems. From the error message you are showing, only the user "hdfs" can create new entries in the /user directory. There are two exceptions to this in your situation:

    1. The user that the NameNode is running under has super-user privileges and will never fail permission checks. The NameNode (and Secondary NameNode & DataNodes are) is typically started by the "hdfs" user which is the owner of the "/user" directory anyways.
    2. The HDFS configuration file (hdfs-site.xml) supports the specification of a "dfs.permissions.superusergroup", which is a user group whose members are also considered super users, and whose requests will never fail permission checks.

    For more details on this here is a link to the Apache HDFS Permissions Guide.