MongoDB adds a user and mongodb group, which starts the process and owns related files, such as logs in / var / log / mongodb and database files in / var / lib / mongodb
If you look in /etc/init.d/mongodb, you will see DAEMONUSER=${DAEMONUSER:-mongodb} - here you can change the user executing mongod.
You will need to add a user and group for your new daemon user, as well as debug files for your new user and group. However, I would not recommend changing the user.
Is there any specific reason why you want to change this user to be what you yourself have defined?
source share