mongodb - 为何运行mongo客户端始终提示我在用root权限运行?
怪我咯
怪我咯 2017-04-27 09:02:04
0
0
417

我的mongodb版本是3.0.5,系统是Ubuntu14.04,在阿里云上运行。
mongod运行正常,使用我自己的配置,运行mongo ip:port之后连接上了,但是会有提示:

2015-07-28T15:49:12.859+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-07-28T15:49:12.859+0800 I CONTROL  [initandlisten]

我确定没有用root用户运行,也没有sudo,用ps命令查看mongo进程的用户也不是root,但是我重启并运行多次仍然有这个警报。
我看了mongo的源码,发现了显示这个警报的代码,是这个文件,相关代码如下:

#if !defined(_WIN32)
    if (getuid() == 0) {
        log() << "** WARNING: You are running this process as the root user, "
              << "which is not recommended." << startupWarningsLog;
        warned = true;
    }
#endif

我自己写了段简单程序测了下getuid的返回值,不是0。
为什么会一直有这个警报呢?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!