我在linux机器上安装并运行了自己的Chef服务器.当我访问我的厨师服务器UI时,它会询问我的用户名和密码.不幸的是我忘记了密码.我知道我的用户名是admin.
我该如何恢复密码?在UI中也没有忘记密码选项.我更改了默认密码p@ssw0rd1.但我忘了我改变了什么.
该密码是存储在我的厨师服务器的任何位置还是重置我的密码?谢谢.
小智 13
如果您具有对服务器的命令行访问权限,则可以使用chef-ctl
sudo chef-server-ctl密码USERNAME
请参见:https://docs.chef.io/ctl_chef_server.html#password
我想你现在唯一能做的就是登录数据库本身并在那里更改密码.
Chef 12.2或更高版本中的数据库结构似乎已更改,因此根据您的版本,您应使用以下命令
(在厨师12.2之前)
$ sudo -u opscode-pgsql /opt/chef-server/embedded/bin/psql opscode_chef
psql# update osc_users set hashed_password = '$2a$12$y31Wno2MKiGXS3FSgVg5UunKG48gJz0pRV//RMy1osDxVbrb0On4W' , salt ='$2a$12$y31Wno2MKiGXS3FSgVg5Uu' where username ='admin';
Run Code Online (Sandbox Code Playgroud)
(厨师12.2及以上)
$ sudo -u opscode-pgsql /opt/opscode/embedded/bin/psql opscode_chef
psql# update users set hashed_password = '$2a$12$y31Wno2MKiGXS3FSgVg5UunKG48gJz0pRV//RMy1osDxVbrb0On4W' , salt ='$2a$12$y31Wno2MKiGXS3FSgVg5Uu' where username ='admin';
Run Code Online (Sandbox Code Playgroud)
admin的新密码是"password".登录并通过Web界面进行更改.