Skip to content

Instantly share code, notes, and snippets.

@hh
Created February 13, 2012 23:37
Show Gist options
  • Save hh/1821492 to your computer and use it in GitHub Desktop.
Save hh/1821492 to your computer and use it in GitHub Desktop.
reset admin webui password for chef
require 'rubygems'
require 'chef/config'
require 'chef/webui_user'
Chef::Config.from_file(File.expand_path("~/.chef/knife.rb"))
user = Chef::WebUIUser.load('admin')
user.set_password("MyAwesomePassword")
user.save
Copy link

ghost commented May 9, 2012

shef, then just copy and paste it in
:

eg:

chef > user.set_password("MyAwesomePassword")
=> "1a8bae6bb72ebf895e106e852c010d3272cf0ff5"
chef > user.save
=> #<Chef::WebUIUser:0x7fdc195cfc90 @admin=true, @couchdb_id="cb651b5f-a625-452e-b572-628bddd11cb8", @openid=nil, @name="admin", @couchdb_rev="1-631eaa937dbb22b920951f36ec282b5a", @password="1a8bae6bb72ebf895e106e852c010d3272cf0ff5", @salt="Wed May 09 19:07:14 +0000 20127vpZaSHf1y7ZRouWFzYHa6c607xxWa", @couchdb=#<Chef::CouchDB:0x7fdc195cfab0 @db="chef", @rest=#<Chef::REST:0x7fdc195cfa60 @redirect_limit=10, @cookies={}, @redirects_followed=0, @auth_credentials=#<Chef::REST::AuthCredentials:0x7fdc195cf9c0 @key_file=nil, @client_name=nil>, @url="http://localhost:5984", @sign_request=true, @default_headers={}, @sign_on_redirect=true>>>
chef >

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment