Hi, I was continuously denied pemission to create openssl key file from the terminal.
Searched the problem in the forum and got the following commands to run sudo rm -r /var/mongodb sudo mkdir -p /var/mongodb/pki/ sudo chown vagrant:vagrant /var/mongodb/pki/ openssl rand -base64 741 > /var/mongodb/pki/m103-keyfile chmod 400 /var/mongodb/pki/m103-keyfile ls -l /var/mongodb/pki ls -l /var/mongodb
and the problem still persist.
However, while following the given steps I ran into a new error saying
“chown: invalid user: ‘vagrant:vagrant’”
Is this for a specific lab or something you are testing?
vagrant is a user specific to vagrant environment from older course
You have replace vagrant with mongod
mongod is the owner of mongodb so it should have proper privs on root owned file system /var
Okay! So what I understand is in newer versions of MongoDB’s own mongod owner is mandatory.
I just have switched to Ubuntu from windows because OpenSSL package wasn’t working on windows.
It’s very strange for me to not be able to set permissions, create users, and connect it to MongoDB.
I have tried to google about it but couldn’t find something which could make sense to me.
Could you give me some references to get to know how to do it?
Hi Ramachandra, I have tried the code again after replacing vagrant with mongodb. mongodb is a listed user on my system. I have changed the file ownership to mongodb using “openssl rand -base64 741 > /var/mongodb/pki/m103-keyfile”. I am attaching the outputs.
Yes, I have followed the same procedure to create the pki directory and it did not work.
However, I tried to use sudo on openssl command which also did not woek. But changing the user using ‘sudo su’ and then running openssl command worked.