# Cannot create regular file '/data/db/ps-entry.sh': Permission denied

**URL:** <https://forums.percona.com/t/cannot-create-regular-file-data-db-ps-entry-sh-permission-denied/14350>\
**Category:** Percona Operator for MongoDB\
**Created:** [February 10, 2022, 1:25pm UTC](https://forums.percona.com/t/cannot-create-regular-file-data-db-ps-entry-sh-permission-denied/14350 "2022-02-10T13:25:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Heckel](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tim_heckel/32/5834_2.png) [@Tim\_Heckel](https://forums.percona.com/u/Tim_Heckel)\
**Post date:** [February 10, 2022, 1:25pm UTC](https://forums.percona.com/t/cannot-create-regular-file-data-db-ps-entry-sh-permission-denied/14350/1 "2022-02-10T13:25:15Z")

</div>

Hi! I’m attempting to install the operator per [these instructions](https://www.percona.com/doc/kubernetes-operator-for-psmongodb/kubernetes.html) but when I run:

`kubectl apply -f deploy/cr.yaml`

The deployment hangs on these two pods:

```auto
mydeploy-mongodb-cfg-0
mydeploy-mongodb-rs0-0

```

With this error in the mongo-init container within the pods:

```auto
+ install -o 2 -g 2 -m 0755 -D /ps-entry.sh /data/db/ps-entry.sh
install: cannot create regular file '/data/db/ps-entry.sh': Permission denied

```

From what I’ve read [here](https://forums.percona.com/t/update-status-error/8301/17) it seems I cannot adjust the permissions directly in the `cr.yaml` file, but need to ssh into the failed mongo-init container to adjust the file/folder permissions.

From what I’ve read [here](https://forums.percona.com/t/percona-mongodb-operator-with-persistentvolumeclaim-on-cephfs/11718) it seems I may be able to adjust the permissions using a `securityContext` inside the `replsets` of `cr.yaml`, but I’m not exactly sure what it should look like or where to put it inside the file.

What is the best approach? Lastly, I am unable to ssh into the failed `mongo-init` container due to the `CrashLoopBackOff` error, and I am unsure where to put a sleep command (something like [this](https://docs.mongodb.com/kubernetes-operator/master/reference/troubleshooting/#debug-a-failing-container)) in the `cr.yaml` file in order to cause the mongo-init container to stay open long enough to ssh into it. If I could at least keep the `mongo-init` container from restarting, I could apply the correct file/directory permissions, though I’d prefer to fix this directly in the `cr.yaml` file.

Thanks so much for your help.

---

<div class="post-metadata">

**Author:** ![Ege\_Gunes](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ege_gunes/32/4595_2.png) [@Ege\_Gunes](https://forums.percona.com/u/Ege_Gunes)\
**Post date:** [February 11, 2022, 7:59am UTC](https://forums.percona.com/t/cannot-create-regular-file-data-db-ps-entry-sh-permission-denied/14350/2 "2022-02-11T07:59:54Z")

</div>

Hi @Tim_Heckel,

It’s most probably due to `securityContext` or environment specific issue with PVCs. Could you please share some details about your environment? Is the cluster on cloud? Is it Openshift or minikube?

---

<div class="post-metadata">

**Author:** ![Tim\_Heckel](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tim_heckel/32/5834_2.png) [@Tim\_Heckel](https://forums.percona.com/u/Tim_Heckel)\
**Post date:** [February 11, 2022, 1:22pm UTC](https://forums.percona.com/t/cannot-create-regular-file-data-db-ps-entry-sh-permission-denied/14350/3 "2022-02-11T13:22:31Z")

</div>

Hi - I’m using Linode’s managed k8 service. Not sure if that’s helpful. I do believe it’s cloud-specific though because I’ve set up another k8 cluster with Hetzner and haven’t run into these permission issues…though I’d love to know if there is a solution to the Linode PVC permissions.

---

<div class="post-metadata">

**Author:** ![Tim\_Heckel](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tim_heckel/32/5834_2.png) [@Tim\_Heckel](https://forums.percona.com/u/Tim_Heckel)\
**Post date:** [February 15, 2022, 3:50pm UTC](https://forums.percona.com/t/cannot-create-regular-file-data-db-ps-entry-sh-permission-denied/14350/4 "2022-02-15T15:50:29Z")

</div>

I did move to a custom k3 solution on hetzner cloud and was able to get past these permission errors.
