Home > Database > Mysql Tutorial > MongoDB中级----MongoDB权限

MongoDB中级----MongoDB权限

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:03:53
Original
1134 people have browsed it

MongoDB默认是不需要输入User和password,客户端就可以登录了 。这个安全问题是很严重的。网上也有很多例子了,但是也有很多细节

MongoDB默认是不需要输入User和password,客户端就可以登录了 。这个安全问题是很严重的。

网上也有很多例子了,但是也有很多细节 许多人都没注意到 我这里顺便提一下。

下面说下如何设置用户名和密码。


添加用户的时候必须在

1.有相关权限的情况下(后面会说)

2.mongod没有加 --auth的情况下。(如果加了,你添加权限的话 会出现下面的情况)

所以我们添加用户时 必须先在没有加 --auth的时候 添加个super  admin

服务起来后,进入./mongo

这样就说明 已经成功建立了,,然后我们试一下权限

在没有加--auth的情况下 可以正常访问admin喜爱默认的两个表

  • > db.system.users.find()  
  •  

  • 已经成功建立。

    下面把服务加上--auth的选项

    再进入./mongo

    可以看出已经没有访问权限了

    linux

  • Related labels:
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Latest Issues
    mongodb start
    From 1970-01-01 08:00:00
    0
    0
    0
    linux - ubuntu14 error installing mongodb
    From 1970-01-01 08:00:00
    0
    0
    0
    Use of symfony2 mongodb
    From 1970-01-01 08:00:00
    0
    0
    0
    mongodb _id rename
    From 1970-01-01 08:00:00
    0
    0
    0
    Parameter understanding of mongodb
    From 1970-01-01 08:00:00
    0
    0
    0
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template