Skip to content

The permissions.json file

philipl edited this page Feb 10, 2014 · 3 revisions

The permissions.json file is a secondary, optional, part of the parcel metadata. It contains file ownership and mode information that should be applied to specific files after the parcel is unpacked (eg: For setting the suid bit on binary).

Why this is necessary

tar files have a limited ability to preserve file ownership and mode information, but this is insufficient to handle all situations.

  • user/group probably don't exist at unpack time: Given that parcel specific users are created by reading the parcel.json file, they won't exist at the time we unpack the parcel, meaning that ownership cannot be preserved.
  • suid/gid bits are not preserved: if you do need to mark a file suid/sgid, it cannot be done through tar.

Consequently, all files are unpacked to the current CM Agent user (usually root) and specific files can get their permissions updated using permissions.json

A permissions.json example

{
  "lib/hadoop-0.20-mapreduce/sbin/Linux/task-controller": {
    "user":  "root",
    "group": "mapred",
    "permissions": "4754"
  },
  "lib/hadoop-yarn/bin/container-executor": {
    "user":  "root",
    "group": "yarn",
    "permissions": "6050"
  },
  "lib/hue/desktop": {
    "user":  "hue",
    "group": "hue",
    "permissions": "0755"
  }
}

Clone this wiki locally