Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chef server password reset

Tags:

chef-infra

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.

like image 426
VijayVishnu Avatar asked Mar 12 '15 07:03

VijayVishnu


People also ask

How do I check my chefs server status?

On each Chef Server there is a Status endpoint located at https://fqdn/_status. It pings the various systems needed for your Chef Server to be healthy and if any return an erroneous response, it will return a HTTP 500 error to the requestor.

How do I delete an organization from Chef server?

Currently, self-service deletion of Hosted Chef organizations is not possible. However, feel free to submit a ticket at [email protected] with the short name of your organization (the one that appears in URLs like https://api.opscode.com/organizations/humptydumpty) and we will help you clean up.


3 Answers

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.

like image 156
Draco Ater Avatar answered Oct 10 '22 17:10

Draco Ater


sudo chef-server-ctl password USERNAME

IMPORTANT to reset webui chef-manage-ctl restart

like image 45
user7290053 Avatar answered Oct 10 '22 17:10

user7290053


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

like image 34
Lol Avatar answered Oct 10 '22 16:10

Lol