Net::SSH2 Using authorized_keys
am 07.10.2008 04:59:26 von pablo90125Last year I wrote some Korn shell scripts to control various programs on our
hosts. It consists of a menu script on the "parent" host that makes SSH
calls to "child" scripts on the remote hosts. This allows us to stop, start
& status the remote programs without having to manually log in to each of
the remote hosts. The SSH calls are similar to this:
ssh remoteuser@remotehost STATUS arg2 arg3 ...
where "STATUS arg2 arg3 ..." are arguments to the child script on
remotehost.
For security reasons, the child program is not specified in the SSH call.
Instead its given in the entry in the authorized_keys file in the .ssh
directory on remotehost. It looks like this:
no-port-forwarding,no-X11-forwarding,no-agent-forwarding,com mand="${HOME}/bin/remote_control.ksh
${SSH_ORIGINAL_COMMAND}" ssh-rsa verylongkey= user@parenthost
where ${HOME}/bin/remote_control.ksh is the name of the child program on
remotehost
and ${SSH_ORIGINAL_COMMAND} is given the arguments passed in the SSH call.
After the previous example call, ${SSH_ORIGINAL_COMMAND} would be equal to
"STATUS arg2 arg3 ...".
The Korn shell scripts work but have lots of limitations. Recently, I
discovered wxPerl and I'm in the process of rewriting the parent program as
a GUI. I've also found the Net::SSH2 package and would like to make use of
it. The docs show how to log in using user id and passwords, but not how to
connect as we do in our menu script. Does anyone have an example?
--
View this message in context: http://www.nabble.com/Net%3A%3ASSH2-Using-authorized_keys-tp 19850252p19850252.html
Sent from the Perl - ActivePerl mailing list archive at Nabble.com.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs