0

I'm facing a problem with my Zsh terminal, i'm trying to deploy a MongoDB local Replica Set for testing. I can't create a keyfile, even if i use sudo command, can't use chown , chmod or openssl rand -base64. I will attach photos. Even my config file of mongod.Config File and ZSH TERMINAL

/usr/local/etc/mongod.conf

storage:
 dbPath: /usr/local/var/mongodb/node1

net:
 port:27011

security:
 authorization: enabled
 keyFile: /var/mongodb/pki/rtype-keyfile

systemLog:
  destination: file
  path: /usr/local/var/log/mongodb/mongo.log
  logAppend: true

processManagement:
 fork: true

replication:
 replSetName: rtypeSet

Im following these steps to create a keyfile

sudo mkdir -p /var/mongodb/pki/
sudo chown $USER:$USER /var/mongodb/pki/
openssl rand -base64 741 > /var/mongodb/pki/m103-keyfile
chmod 400 /var/mongodb/pki/rtype-keyfile

Actual zsh terminal execution showing errors:

 Last login: Wed May 3 17:48:42 on ttys000
 ^C
[Heidis-MacBook-Pro% sudo mkdir -p /var/mongodb/pki/
[Password:
[Heidis-MacBook-Pro% sudo chown $redacted $redacted /var/mongodb/pki/
[Heidis-MacBook-Pro% openssl rand -base64 756 > /var/mongodb/pki/rtype-keyfile
 zsh: permission denied: /var/mongodb/pki/rtype-keyfile
[Heidis-MacBook-Pro% chmod 400 /var/mongodb/pki/rtype-keyfile
 chmod: /var/mongodb/pki/rtype-keyfile: No such file or directory
 Heidis-MacBook-Pro%

As you can see when creating the folder it does not return any results, don't create any file, just give me permission denied

i already follow these steps and still not working (here below) https://iboysoft.com/howto/fix-zsh-permission-denied-in-mac-terminal.html

Thank you for your help! I have been dealing with this problem since 4 days:(

I hope to find a way, to solve this permission denied problem, pd: I have not installed Oh my Zsh.

rickhg12hs
  • 10,638
  • 6
  • 24
  • 42
  • Please don't use images for text/code/errors/tracebacks/etc. - just include the text in a code block. – rickhg12hs May 03 '23 at 22:51
  • Few notes. 1. There should be : between user:group in chown. 2. you should go to that directory and try to create there that rtype-keyfile. IF you cannot go to that directory, solve problem at point 1. until you are allowed to cd there... Then 3. rtype-keyfile should be readable for user what you use to run mongod. nobody else. You are (probably) not use who is runing mongod. Other solution for point 2. is use sudo command with openssl, and then change that result to mongod readable. – JJussi May 04 '23 at 19:11

0 Answers0