[DOCS-5927] Changing run-time user of mongod process Created: 29/Jul/15  Updated: 30/Oct/23  Resolved: 01/Nov/22

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Improvement Priority: Major - P3
Reporter: Andre Spiegel Assignee: Andrew Aldridge
Resolution: Won't Fix Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 1 year, 14 weeks, 1 day ago
Epic Link: DOCSP-1769

 Description   

We're running into trouble changing the unix run-time user under which mongod runs, as specified by the init.d startup script. This needs to be fully documented, and possibly made easier by an automated script that carries out the necessary changes.



 Comments   
Comment by Education Bot [ 01/Nov/22 ]

Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you!

Comment by Mark Helmstetter [ 09/Sep/15 ]

Here's what I've got so far for the process:

After changing these settings the user mongouser should also have access to start/stop mongod.

service mongod stop

vi /etc/init.d/mongod - change the following lines ~line 25-26:
MONGO_USER=mongouser
MONGO_GROUP=mongouser

chown mongouser:mongouser /var/log/mongodb/mongod.log

^^^ May need to change this path based on the logPath setting in mongod.conf

chown mongouser:mongouser /var/run/mongodb/

^^^ May need to change if pidfilepath setting in mongod.conf file is different

chown mongouser:mongouser /etc/mongod.conf

chown -R mongouser:mongouser /data/db

^^^ May need to change if dbPath setting in mongod.conf file is different

At this point, the user mongouser would have permission to start mongod by running:

However, mongouser would not be able to run "service mongod start" without further changes. Ideally we should have a process for fixing this as well.

Generated at Thu Feb 08 07:51:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.