Closed xinthink closed 11 years ago
Hi!
You can achieve that by running mongoctl as a nologin user and the mongod should inherit that since its a subprocess of mongoctl. You will need to have the ".mongoctl" dir in your sudo user home dir unless you pass --config-root to on the login user ".mongoctl" dir. So you can do something like
> sudo -u _mongo mongoctl start SampleServer
OR
> sudo -u _mongo mongoctl --config-root /home/abdul/.mongoctl start SampleServer
Hope that helps.
Cheers!
-abdul
Thanks a lot!
The config location problem, here's my solution:
# find sudo user home
sudo -u _mongo -H bash -c 'echo $HOME'
# link my .mongodb
sudo ln -sf `echo ~`/.mongoctl/ <sudo_user_home>/.mongoctl
For security reason, I'd like to run mongod as a nologin user, '_mongo' for example.
I used to start mongod using command:
sudo -u _mongo mongod ...
Now I want to switch to mongoctl, but I don't how to achieve this with mongoctl.