问题
I installed and run my own Chef server in my linux machine. When I access my chef server UI it ask me username and password. Unfortunately I forgot my password. I know my user name is admin
.
How can I recover my password? In the UI there is no forgot password option also. I changed the default password which is p@ssw0rd1
. But I forgot what I have changed.
Is that password is stored in any location of my chef server or Is that anyway to reset my password? Thanks.
回答1:
I guess the only thing you can do now is to login into database itself and change the password there.
The database structure seems to have changed in Chef 12.2 or later, so based on your version you should use the following commands
(Before Chef 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';
(Chef 12.2 and above)
$ 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';
The new password for admin is "password". Login and change it through web interface.
回答2:
If you have command line access to the server, then you can use chef-ctl
sudo chef-server-ctl password USERNAME
See here: https://docs.chef.io/ctl_chef_server.html#password
回答3:
sudo chef-server-ctl password USERNAME
IMPORTANT to reset webui chef-manage-ctl restart
来源:https://stackoverflow.com/questions/29003760/chef-server-password-reset