Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: using Net::SSH::Perl: problem with Math::Pari

by sgt (Deacon)
on May 07, 2008 at 22:42 UTC ( [id://685344]=note: print w/replies, xml ) Need Help??


in reply to using Net::SSH::Perl: problem with Math::Pari

Humm, you say you are on Un*x. Why not qx(ssh host command)? or is it that you wished to use Net::SSH::Perl mainly to bend authorization (passwd, certs etc) rules

cheers --stephan
  • Comment on Re: using Net::SSH::Perl: problem with Math::Pari

Replies are listed 'Best First'.
Re^2: using Net::SSH::Perl: problem with Math::Pari
by Anonymous Monk on May 08, 2008 at 09:13 UTC
    I don't understand what you mean with bending the authoriation rules...

    I just want a script able to log in via ssh2 periodically as a cron job, so not requesting any user interaction.

      Well, first you are aware that 'ssh host command' runs command on host, aren't you. If certificates have been set up you will not be prompted for a passwd. So this would be suitable for cron. Note that command will be executed by the system shell, so you can actually use perl on the local side to build a (shell) script. You could also scp the command (or script) and then execute it remotely.

      Now if the remote sshd asks for a passwd, you'll need to pass the passwd using expect for example (Perl module or command), or tweak pssh the client that comes with Net::Ssh::Perl so that it can read the passwd from a file o env_var o whatever.

      Finally there are security implications doing the latter.

      As an example I'll show you a remote uname -a using expect and ssh:

      #!/bin/expect -f spawn "ssh -l my_user remote_host uname -a\r" expect -re "[Pp]assword: " send "my_passwd\r"
      cheers --stephan

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://685344]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-20 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found