Chown not working as it says the directory doesn't exist even though I'm looking right at it

Title explains the issue; per the screenshot the directory in question can be seen but it still won’t let me use the chown command. Let me know if there’s anything I can do to help.

image

In actual fact:
image

1 Like

/var/mongodb/db is not same as /home/vagrant/var/mongodb/db
~ indicates your home dir

2 Likes

why is there a home? My mongod is looking for the path without the home?

For the same reasons that you have C:\User\Michael in windows. See https://www.pcmag.com/encyclopedia/term/home-directory

Hi @Michael_Mouch_05092,

Please refer this link to read about the concept of absolute path and relative path.

var/mongodb/db should be created in the root directory (/) and not in your home directory i.e. /home/vagrant.

Please use this command to create the directories in the root (/) directory :

sudo mkdir -p /var/mongodb/db

Change the ownership by running this command :

sudo chown vagrant:vagrant /var/mongodb/db

Hope it helps!

Please feel free to get back to us if you have any other query.

Thanks,
Shubham Ranjan
Curriculum Services Engineer