# Error Generating Encryption Key - Error: ENOENT: no such file or directory

**URL:** <https://discuss.elastic.co/t/error-generating-encryption-key-error-enoent-no-such-file-or-directory/310814>\
**Category:** Kibana\
**Created:** [July 28, 2022, 4:32am UTC](https://discuss.elastic.co/t/error-generating-encryption-key-error-enoent-no-such-file-or-directory/310814 "2022-07-28T04:32:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aniketdatir](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@aniketdatir](https://discuss.elastic.co/u/aniketdatir)\
**Post date:** [July 28, 2022, 4:32am UTC](https://discuss.elastic.co/t/error-generating-encryption-key-error-enoent-no-such-file-or-directory/310814/1 "2022-07-28T04:32:43Z")

</div>

Hi Kibana team,

I m trying to generate encryption keyusing below command but getting error

ubuntu@host:/usr/share/kibana$ bin/kibana-encryption-keys generate  
Error: ENOENT: no such file or directory, open '/usr/share/kibana/config/kibana.yml'  
at Object.openSync (node:fs:585:3)  
at readFileSync (node:fs:453:35)  
at new EncryptionConfig (/usr/share/kibana/src/cli\_encryption\_keys/encryption\_config.js:38:57)  
at Object. (/usr/share/kibana/src/cli\_encryption\_keys/cli\_encryption\_keys.js:23:26)  
at Module.\_compile (node:internal/modules/cjs/loader:1103:14)  
at Object.Module.\_extensions..js (node:internal/modules/cjs/loader:1157:10)  
at Module.load (node:internal/modules/cjs/loader:981:32)  
at Function.Module.\_load (node:internal/modules/cjs/loader:822:12)  
at Module.require (node:internal/modules/cjs/loader:1005:19)  
at Module.Hook.\_require.Module.require (/usr/share/kibana/node\_modules/require-in-the-middle/index.js:80:39)

Kindly suggest how to solve this issue. Thanks

---

<div class="post-metadata">

**Author:** ![aniketdatir](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@aniketdatir](https://discuss.elastic.co/u/aniketdatir)\
**Post date:** [July 28, 2022, 8:13am UTC](https://discuss.elastic.co/t/error-generating-encryption-key-error-enoent-no-such-file-or-directory/310814/2 "2022-07-28T08:13:59Z")

</div>

Hi Team,  
I solved this issue. Plz close the topic

---

<div class="post-metadata">

**Author:** ![tiagocosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiagocosta/32/40045_2.png) [@tiagocosta](https://discuss.elastic.co/u/tiagocosta)\
**Post date:** [July 28, 2022, 4:25pm UTC](https://discuss.elastic.co/t/error-generating-encryption-key-error-enoent-no-such-file-or-directory/310814/3 "2022-07-28T16:25:03Z")

</div>

@aniketdatir could you please list here what was causing your problem so it can be used for future reference and mark it as the solution? 😃

---

<div class="post-metadata">

**Author:** ![aniketdatir](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@aniketdatir](https://discuss.elastic.co/u/aniketdatir)\
**Post date:** [August 2, 2022, 8:05am UTC](https://discuss.elastic.co/t/error-generating-encryption-key-error-enoent-no-such-file-or-directory/310814/4 "2022-08-02T08:05:15Z")

</div>

Hi @tiagocosta 🙂 ,

as the error suggest above, it was searching kibana.yml inside config folder but this folder was not present.

So, i created folder named config inside ''/usr/share/kibana/' and copied the kibana.yml file inside it.  
Then using root user I run the above command and generated encryption key.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 30, 2022, 8:05am UTC](https://discuss.elastic.co/t/error-generating-encryption-key-error-enoent-no-such-file-or-directory/310814/5 "2022-08-30T08:05:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
