[CentOS] OT: Scripting with sudo password

Garrick Staples garrick at usc.edu
Thu Nov 15 01:13:55 UTC 2007

On Wed, Nov 14, 2007 at 05:13:37PM -0800, James A. Peltier alleged:
> gjgowey at tmo.blackberry.net wrote:
> >How about using ssh with certificate authenitication instead of sudo?
> >
> That's great for SSH, I already do that, but if I ssh to a system and 
> then type sudo it prompts me for a password.  I want something like this
> ssh_and_sudo_on_all_hosts
> this script prompts for passwords and provides passwords to all ssh or 
> sudo sessions
> ssh => some_host
> uses keys/certificates whatever so no password
> sudo do_some_command (prompts for password)
> password entered at start of ssh_and_sudo_on_all_hosts is passed to sudo 
> and sudo runs.

The solution is password-less authentication.  Kerberos, ssh keys, sudo, etc.
But you don't seem to want to do those things.

So do exactly as you've already mentioned, use expect, prompt for a password,
and feed the passord to remote shells as required.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.centos.org/pipermail/centos/attachments/20071114/b8b9eba9/attachment.sig>

More information about the CentOS mailing list