Here's how I've done that in the past:
run "passwd", :pty => true do |ch, stream, data|
if data =~ /Enter new UNIX password:/
ch.send_data(Capistrano::CLI.password_prompt(
"New root password: ") + "\n")
elsif data =~ /Retype new UNIX password:/
ch.send_data(Capistrano::CLI.password_prompt(
"Retype new root password: ") + "\n")
else
Capistrano::Configuration.default_io_proc.call(ch, stream, data)
end
end
Here's a pastie, if the above didn't get formatted well by your email
client:
http://pastie.org/385103
- Jamis
On 2/10/09 9:39 AM, sant0sk1 wrote:
> A use case:
>
> There are n debian servers being managed on a LAN and the admin wants
> to synchronize their root user's password using Capistrano. The user
> wants to execute something like: cap ROLES=debian set_root_pw. The
> user is then prompted for the new password one time (with
> confirmation) and the password is changed on all n machines.
>
> I'd like to implement something like this but I can't seem to find a
> non-interactive 'passwd' method. Are there other ways to get this
> done? One thought is to generate the hashed password locally and have
> Cap edit the /etc/shadow files of all the remote hosts. Not sure if
> that would work with salting and whatnot. Any other ideas of how to
> get this done?
>
> Thanks guys. Love Cap!
> >
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---