# Init Hook Permissions Issue

**URL:** <https://discourse.chef.io/t/init-hook-permissions-issue/18541>\
**Category:** Habitat Help\
**Created:** [November 10, 2018, 7:25am UTC](https://discourse.chef.io/t/init-hook-permissions-issue/18541 "2018-11-10T07:25:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thedarkula](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/thedarkula/32/2793_2.png) [@thedarkula](https://discourse.chef.io/u/thedarkula)\
**Post date:** [November 10, 2018, 7:25am UTC](https://discourse.chef.io/t/init-hook-permissions-issue/18541/1 "2018-11-10T07:25:35Z")

</div>

I’m developing a plan for `core-plans`. In my init script, I have this in my `init` hook:

```auto
ln -sf {{ pkg.path }}/gitea/lib {{ pkg.svc_var_path }}/lib
ln -sf {{ pkg.path }}/gitea/log {{ pkg.svc_var_path }}/log
ln -sf {{ pkg.path }}/gitea/lfs {{ pkg.svc_data_path }}/lfs
ln -sf {{ pkg.path }}/gitea/.ssh {{ pkg.svc_data_path }}/.ssh
ln -sf {{ pkg.path }}/gitea/git {{ pkg.svc_data_path }}/git

chown git:git -RL {{ pkg.path }}/gitea
chown git:git -RL {{ pkg.svc_var_path }}/lib
chown git:git -RL {{ pkg.svc_var_path }}/log

```

And this in `do_install()`:

```auto
  mkdir -p $pkg_prefix/gitea/lib/gitea
  mkdir -p $pkg_prefix/gitea/log/gitea
  mkdir -p $pkg_prefix/gitea/lfs
  mkdir -p $pkg_prefix/gitea/.ssh
  mkdir -p $pkg_prefix/gitea/git

```

I’m getting the following output:

```auto
gitea.default hook[init]:(HK): chown: changing ownership of '/hab/pkgs/core/gitea/1.5.3/20181110063557/gitea/.ssh': Operation not permitted

```

Also, I have these two options set:

```auto
pkg_svc_user=git
pkg_svc_group=git

```

I’ve run `hab studio rm` as well.  
Anyone have any ideas on why the `init` hook isn’t happy?

---

<div class="post-metadata">

**Author:** ![bdangit](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bdangit/32/1466_2.png) [@bdangit](https://discourse.chef.io/u/bdangit)\
**Post date:** [November 10, 2018, 5:30pm UTC](https://discourse.chef.io/t/init-hook-permissions-issue/18541/2 "2018-11-10T17:30:08Z")

</div>

You got the right idea about getting your runtime to execute things from the `svc` folders; however, you should treat things in `$pkg_prefix` as immutable.

If there’s no state to care about from the pkg (and there shouldn’t be any state you store other than default), then removing any of the symbolic links should be a first thing to do. As those things like logs, lfs objects, etc should NOT be stored in the pkg folders. Think eventual future would be that you would mount drives to the svc data and var paths.

---

<div class="post-metadata">

**Author:** ![thedarkula](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/thedarkula/32/2793_2.png) [@thedarkula](https://discourse.chef.io/u/thedarkula)\
**Post date:** [November 10, 2018, 10:23pm UTC](https://discourse.chef.io/t/init-hook-permissions-issue/18541/3 "2018-11-10T22:23:54Z")

</div>

Having the thought of `$pkg_prefix` being immutatable helped. I just reworked the configs to point directly to the `svc` directories. Thanks so much.
