You created the directory in the wrong place
/data/db means that it's directly under the '/' root directory, whereas you created 'data/db' (without the leading /) probably just inside another directory, such as the '/root' homedirectory.
You need to create this directory as root
Either you need to use sudo
, e.g. sudo mkdir -p /data/db
Or you need to do su -
to become superuser, and then create the directory with mkdir -p /data/db
Note:
MongoDB also has an option where you can create the data directory in another location, but that's generally not a good idea, because it just slightly complicates things such as DB recovery, because you always have to specify the db-path manually. I wouldn't recommend doing that.
Edit:
the error message you're getting is "Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied". The directory you created doesn't seem to have the correct permissions and ownership --
it needs to be writable by the user who runs the MongoDB process.
To see the permissions and ownership of the '/data/db/' directory, do this:
(this is what the permissions and ownership should look like)
$ ls -ld /data/db/
drwxr-xr-x 4 mongod mongod 4096 Oct 26 10:31 /data/db/
The left side 'drwxr-xr-x' shows the permissions for the User, Group, and Others.
'mongod mongod' shows who owns the directory, and which group that directory belongs to.
Both are called 'mongod' in this case.
If your '/data/db' directory doesn't have the permissions and ownership above, do this:
First check what user and group your mongo user has:
# grep mongo /etc/passwd
mongod:x:498:496:mongod:/var/lib/mongo:/bin/false
You should have an entry for mongod in /etc/passwd , as it's a daemon.
sudo chmod 0755 /data/db
sudo chown -R 498:496 /data/db # using the user-id , group-id
You can also use the user-name and group-name, as follows:
(they can be found in /etc/passwd and /etc/group )
sudo chown -R mongod:mongod /data/db
that should make it work..
In the comments below, some people used this:
sudo chown -R `id -u` /data/db
sudo chmod -R go+w /data/db
or
sudo chown -R $USER /data/db
sudo chmod -R go+w /data/db
The disadvantage is that $USER is an account which has a login shell.
Daemons should ideally not have a shell for security reasons, that's why you see /bin/false in the grep of the password file above.
Check here to better understand the meaning of the directory permissions:
http://www.perlfect.com/articles/chmod.shtml
Maybe also check out one of the tutorials you can find via Google: "UNIX for beginners"
This fixed it for me:
$ sudo chmod -R 755 /usr/local/share/zsh/site-functions
Credit: a post on zsh mailing list
EDIT: As pointed out by @biocyberman in the comments. You may need to update the owner of site-functions
as well:
$ sudo chown -R root:root /usr/local/share/zsh/site-functions
On my machine (OSX 10.9), I do not need to do this but YMMV.
EDIT2: On OSX 10.11, only this worked:
$ sudo chmod -R 755 /usr/local/share/zsh
$ sudo chown -R root:staff /usr/local/share/zsh
Also user:staff is the correct default permission on OSX.
Best Answer
This is an issue with ZSH, your shell, not Hyper, your terminal. I actually had the same issue earlier today. There are some solutions in this issue on Github, and I will quote some of them here but I recommend you follow the link and read the comments there.
The first solution is to change the ownership of the problematic directories.
I will not recommend this without knowing more about your environment, but for most people this will fix the issue:
The second solution is to set
ZSH_DISABLE_COMPFIX=true
(or"true"
in quotes) in your.zshrc
file, to tell ZSH to not check for insecure directories.The third solution, and the solution that fixed the issue for me, is to initialise compinit with the
-u
flag. This will use all the directories found bycompaudit
without checking them for security issues. To do this, you will have to change your.zshrc
file or wherever you are configuring autocomplete.