[Ssh-sftp-perl-users] Help with ssh-agent
Brought to you by:
dbrobins
From: Julien E. <pan...@as...> - 2004-12-02 09:40:49
|
Hi all, I'm pretty new with Net::SSH:Perl and I'm trying something perhaps too difficult for me. Here is it : I run keychain, an OpenSSH key manager. When running it first time, it asks for the passphrase of the key and give it to a ssh-agent. To use my key, I need to run : $ SSH_AUTH_SOCK=/tmp/ssh-lPqB5586/agent.5586; export SSH_AUTH_SOCK; $ SSH_AGENT_PID=5588; export SSH_AGENT_PID; For example. With this, I need to connect to a remote ssh server with public key authentication without typing a password. I really need this because I can't type a passphrase or pass AND I don't want to stock the password in the perl script (I work in root). Here's the base script I'm trying to make work : #!/usr/bin/perl use Net::SSH::Perl; my $ssh = Net::SSH::Perl->new("192.168.1.9"); my $auth = Net::SSH::Perl::Auth->new('PublicKey', $ssh); $auth->authenticate; $ssh->login("root"); $ssh->cmd("/bin/touch /ok.txt"); Of course, it doesn't work : Can't call method "agent" on an undefined value at /usr/local/share/perl/5.8.2/Net/SSH/Perl/Auth/PublicKey.pm line 42, <GEN0> line 1. I cannot find any example to use an ssh-agent in the doc or on internet (I searched the list archives too). Can someone give me a few tips on how to do this ? Thanks Julien Escario |