Skip to content

Instantly share code, notes, and snippets.

@jellybob
Created October 6, 2010 10:53
Show Gist options
  • Save jellybob/613172 to your computer and use it in GitHub Desktop.
Save jellybob/613172 to your computer and use it in GitHub Desktop.
unless ARGV[0] && ARGV[1]
puts "Usage: set_password.rb username password"
exit 1
end
require 'chef'
require 'chef/config'
require 'chef/webui_user'
Chef::Config.from_file(File.expand_path("~/.chef/knife.rb"))
user = Chef::WebUIUser.load(ARGV[0])
if user
user.set_password(ARGV[1])
user.save
else
puts "Could not find user #{ARGV[0]}."
exit 2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment