Mongodb start error with security.authorization enabled - macos

I am getting an error attempting to start mongo with authorization enabled via the security.authorization configuration parameter (see http://docs.mongodb.org/manual/reference/configuration-options/#security.authorization)
On running mongod I get
Error parsing INI config file: unknown option security.authorization
try 'mongod --help' for more information
Any idea?
Thanks
Supporting data:
Mongo version 2.6.0 (installed via homebrew)
OSX Mavericks 10.9.2
start command:
mongod -f /usr/local/etc/mongod.conf
mongod.conf file (works fine if I comment out security.authorization):
# Store data in /usr/local/var/mongodb instead of the default /data/db
dbpath = /usr/local/var/mongodb
# Append logs to /usr/local/var/log/mongodb/mongo.log
logpath = /usr/local/var/log/mongodb/mongo.log
logappend = true
# Only accept local connections
bind_ip = 127.0.0.1
# auth
security.authorization = enabled
#security.authenticationMechanisms = MONGODB-CR #error occurs with or without this
No entry is made in the mongo.log file when this occurs

Note: I would have written this as a comment, however I do not have the points yet.
Just wondering whether what you are trying to achieve is authentication instead? If this is the case, all you need to set in mongodb.conf is:
# auth
auth = true # true or false. Whether or not authentication is required.
-- UPDATED:
Some other steps that are important:
Configure the db location: Set in mongodb.conf as (you already have this, but should check the directory and permissions exist):
# Store data in /usr/local/var/mongodb instead of the default /data/db
dbpath = /usr/local/var/mongodb
# Append logs to /usr/local/var/log/mongodb/mongo.log
logpath = /usr/local/var/log/mongodb/mongo.log
logappend = true
Dont forget to make sure the above /usr/local/var/mongodb directory and /usr/local/var/log/mongodb/ directory exist. The installer that you used may not have made them.
Create an Operating System user for mongodb: (If one has not already been created - this is how on linux, not sure for osx) - as root:
adduser --system --no-create-home --disabled-login --disabled-password --group mongodb
Add permissions to folders if they are not already set:
chown mongodb:mongodb -R /usr/local/var/mongodb
To setup database user authorization / privileges:
See the command reference here: http://docs.mongodb.org/manual/reference/command/#database-commands

MongoDB server config file format changed from version 2.6 and still old format works.
http://docs.mongodb.org/manual/reference/configuration-options/
Changed in version 2.6: MongoDB introduces a YAML-based configuration file format. The 2.4 configuration file format remains for backward compatibility.
The error is due to the reason your config file is using old format and adding parameter security.authorization = enabled using new format.You can fix the problem by
using old format settings mentioned at http://docs.mongodb.org/v2.4/reference/configuration-options
auth = true
or by converting conf file to new YAML format.

Related

How to set Data cube config file?

I'm trying to work on a new project and I red about Data Cube that can really help me.
In order to use it and to try to work with it, I installed postgres as required on the official website: https://datacube-core.readthedocs.io/en/datacube-1.4.1/ops/db_setup.html
When trying to initialize the dataset with this command:
datacube -v system init
I get the error: "Error: No datacube config found"
As requested I added env var and tried to put the config file everywhere (home dir, default, current...)
config file:
[datacube]
db_database: datacube
# A blank host will use a local socket. Specify a hostname (such as localhost) to use TCP.
db_hostname:
# Credentials are optional: you might have other Postgres authentication configured.
# The default username otherwise is the current user id.
db_username: postgres
db_password: postgres
I'm using windows 10 with conda, python 3.8,
Do you know what I'm missing?
TIA
As provided in documentation -
Datacube looks for a configuration file in ~/.datacube.conf or in the
location specified by the DATACUBE_CONFIG_PATH environment variable.
Make sure you file name is datacube.conf and it is in the proper path

Where is etcd config file in Mac OS

I have installed etcd in my mac using brew. I know we can pass the custom config file when starting the etcd using --config-file flag but I am not able to locate the default config file of etcd. So could you please let me know the location of the default config file of etcd?
By reading the Homebrew formula/package definition of etcd. It doesn't include any default config file.

"Unable to write to the configuration file." Error with Magento Connect Manager 1.9.3.2

After migrating my Apache server from Ubuntu 14.04 to CentOS 7, I started experiencing these permission errors.
On the Magento Connect Manager login page, I'm hit with an error message and unable to login:
Unable to write to the configuration file.
The error remained even after I set the permission for every file and folder to 0777.
I then deleted the .cfg files in the "downloader" folder. Now the error message has become:
Settings has not been loaded. Used default settings Config file does not exists please save Settings Unable to write to the configuration file.
After login/logout, restarting the Apache server and even the entire host, the error remained. The error logs did not record anything at all.
On Debian 8.6 with Magento-1.9.3.6 the chown following command:
chown www-data:www-data var/brute-force.ini
enable right to write and unlock the access to Magento Connect Manager
Solved!
SELinux was preventing Apache from writing to the directory.
I used the following command to enable it:
chcon -t httpd_sys_rw_content_t /var/www/html -R

www-data can't find the ruby gems on vagrant configured virtualbox

I'm trying to get a virtual server running using Vagrant and VirtualBox. For the VirtualBox I'm using scotch/box which got all the basic stuff for running a ubuntu server with some components (apache, mysql, php etc.) more on scotchbox can be found here.
Now I got the server up and running (running a Yii2 application) but as soon as the application starts I get an Yii error message sh: 1: sass: not found and because of that a SASS file couldn't be converted to CSS. So I went back to my server to check if sass was installed, it wasn't so I ran the command gem install sass and after that sass was installed. gem list sass -i returned true.
But still the problem stayed, sass couldn't be found. I went back to my console and of course apache is ran by user www-data and I logged in to ssh with the vagrant user. And this is were it gets a bit vague for me. In the environments variables of the apache service I added the paths to both ruby and the gems. But still the www-data user cannot find the sass command or the gem command or even the ruby command.
I also tried to change the owner of the apache service from www-data to the vagrant user that did kinda help but thats not the solution I want to accept. I want a solution that the apache service stays owned by the www-data user and not a root user like vagrant.
If more data needs to be added please let me know.
Envvars file
envvars - default environment variables for apache2ctl
# this won't be correct after changing uid
unset HOME
# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
SUFFIX=
fi
# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
# temporary state file location. This might be changed to /run in Wheezy+1
export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale
export LANG
## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'
## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'
## If you would like to pass arguments to the web server, add them below
## to the APACHE_ARGUMENTS environment.
#export APACHE_ARGUMENTS=''
## Enable the debug mode for maintainer scripts.
## This will produce a verbose output on package installations of web server modules and web application
## installations which interact with Apache
#export APACHE2_MAINTSCRIPT_DEBUG=1
export GEM_HOME=/home/vagrant/.rvm/gems/ruby-2.1.3
export GEM_PATH=/home/vagrant/.rvm/gems/ruby-2.1.3:/home/vagrant/.rvm/gems/ruby-2.1.3#global
export MY_RUBY_HOME=/home/vagrant/.rvm/rubies/ruby-2.1.3
export IRBRC=/home/vagrant/.rvm/rubies/ruby-2.1.3/.irbrc
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Try to find out whether the PATH that apache uses is indeed modified by your adjustments of the envvars file. You could do this by simply putting running this php code:
var_dump(getenv("PATH"));
die;
I've had the exact same problem. After a long time trying it turned out that service apache2 stop and start in vagrant is not working as expected. After setting the PATH variable in /etc/apache2/envvars try reloading apache by reloading vagrant instead: vagrant reload

How can stop Homebrew installing Postgres as root?

I have a Postgres permissions problem, every time i brew install postgres it does so as root user resulting in permissions denial on initdb, createdb and or anything else i try.
I sudo chown the ownership of /usr/local/var/postgres and it seems to change and allow me manual entry into the directory from cmd line, which then only consists of a server.log file listing the error:
postgres cannot access the server configuration file "/usr/local/var/postgres/postgresql.conf": No such file or directory
I then go to initdb and it returns:
The files belonging to this database system will be owned by user "jamesbkemp".
This user must also own the server process.
The database cluster will be initialized with locale "en_GB.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
initdb: directory "/usr/local/var/postgres" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/usr/local/var/postgres" or run initdb
with an argument other than "/usr/local/var/postgres"
I then go back to look at /usr/local/var/postgresand the owner has changed back to root. I really am at a loss after many hours on this as to what's going on. Any ideas folks?
Postgresql install as non root is a pain if not impossible, because it was not designed this way: it is a multi-user service.
The same thing here: apache2 as non-root - you would have to build the server yourself changing the configuration a lot.
Let me add that for an experienced datacenter operator this is a strange idea, like driving a race car in your appartment.

Resources