Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

SSH and Sudo

by davidsnt (Novice)
on Nov 16, 2012 at 06:25 UTC ( #1004137=perlquestion: print w/replies, xml ) Need Help??
davidsnt has asked for the wisdom of the Perl Monks concerning the following question:

I need to write a application that can log in to a serevr farm and change as different user (sudo su -l user2) and execute a couple of commands and print the results. I dont want to use Expect module to supply the passwords and I dont have the infrastructure to have the ssh fingerprint copied to all the servers in the farm. Is there a possibility to use the default ssh -t option with Net::SSH::Perl module

Replies are listed 'Best First'.
Re: SSH and Sudo
by salva (Abbot) on Nov 16, 2012 at 08:50 UTC
Re: SSH and Sudo
by betterworld (Curate) on Nov 16, 2012 at 07:47 UTC

    ssh -t makes sure that sudo can prompt for a password. Copying ssh fingerprints (or public keys) avoids the password prompt by ssh. These are two different things.

Re: SSH and Sudo
by shmem (Chancellor) on Nov 16, 2012 at 07:34 UTC
    Is there a possibility to use the default ssh -t option with Net::SSH::Perl module

    Offhand, I'd say yes. Did you try?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1004137]
Approved by tobyink
Front-paged by Arunbear
help
Chatterbox?
[Lady_Aleena]: Well, not much of my code. A few little things people here like. The big things though, the more important to me code, people here seem to loathe.
[atcroft]: Lady_Aleena: My early code was pretty horrible... but somewhere early on I learned not to take criticism of my code personally... which was probably a good thing, considering the kind of code I wrote at the time. :\
[Lady_Aleena]: I am hungry, so I'm going to go make something to eat. I hope you figure it out atcroft. Have a nice night!
[atcroft]: I have one script that I have started re-writing several times over the years, and have yet to get it working in a cleaner/better form. (It is some smelly code-I did not even know about hashes at the time I wrote it.)
[atcroft]: Enjoy, Lady_Aleena!

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2017-05-27 05:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?