hdfsChown()

Supported by libMaprClient for hadoop-2.x

Changes ownership of a file or directory in the manner of the chown command.

Attention:
  • To permit a client to resolve user or group from a server, set the fs.mapr.server.resolve.user parameter to true in core-site.xml, for both secure and non secure clusters. Setting this is essential when the client does not belong to the same domain as the mapr cluster nodes, and does not have any knowledge of users present in that domain.
  • To permit CLDB to resolve user or group, set the cldb.security.resolve.user configuration parameter to 1 on a non-secure cluster as follows:
    maprcli config save -values {"cldb.security.resolve.user":1}

    You do not have to set this parameter for a secure cluster, as it is already set to 1.

Signature

int hdfsChown(hdfsFS fs, const char* path, const char *owner, const char *group)

Parameters

Parameter Description
fs The handle to the filesystem. Obtain this handle with one of the hdfsConnect() APIs.
path The path to the file or directory
owner The user to own the file or directory. Set to NULL to keep the owner as is.
group The group to own the file or directory. Set to NULL to keep the owner as is.

Return Value

Returns 0 on success, -1 on error.

Check errno for error codes and meanings.

errno is set to EINVAL if the input arguments are invalid.

errno is set to EPERM if the process does not have enough privileges to perform the operation.