Elasticsearch+x-pack认证,修改默认口令时报错

自行车丢了 发布于 2017/08/23 10:19
阅读 957
收藏 0

修改elastic用户口令时,报错,执行的命令和报错如下:

curl -XPUT -u elastic 'localhost:9200/_xpack/security/user/elastic/_password' -H "Contentpe: application/json" -d '{ "password" : "elastic123" }'

Enter host password for user 'elastic': changeme

{"error":{"root_cause":[{"type":"security_exception","reason":"failed to authenticate user [elastic]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"failed to authenticate user [elastic]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}

上面的错误估计很多人遇到吧,大家都怎么解决的呢?

加载中
0
dog-head
dog-head

digest鉴权了。。摘要加密Basic ,需要先通过认证才能进行操作

python代码:

import requests
from requests.auth import AuthBase
from requests.auth import HTTPBasicAuth

auth=HTTPBasicAuth('elastic','changeme')
r=requests.get(url="http://ip:9200",auth=auth)
print(r.text)

这里的get改成put,带上你的参数。就可以了应该。。
 

返回顶部
顶部