Re: Source keychain credentials in Perl?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wed, Mar 5, 2008 at 11:15 AM, Sean Carolan <scarolan@xxxxxxxxx> wrote:
>  Just so it is clear what I am trying to do, there are some scp and ssh
>  commands like:
>
>  system ("/usr/bin/scp /tmp/filename server1:/tmp/filename");
>
>  we want the scp command to use the running ssh-agent's credentials to
>  log onto the remote server.

One solution would be to "source ~/.keychain/hostname-sh" in the shell
before calling the perl script. That should work.

Another one would be to source it before calling scp:

system ("source ~/.keychain/hostname-sh; /usr/bin/scp /tmp/filename
server1:/tmp/filename");

The third one (if you don't use a shell to invoke the perl and you
don't want to change every "system" call) would be to parse the file
inside perl and to modify the %ENV variable to include these two
variables. What you want is the equivalent of:

$ENV{SSH_AUTH_SOCK} = "/tmp/ssh-XXn47DUn/agent.16721";
$ENV{SSH_AGENT_PID} = "16722";

But of course you'd have to parse the file to get the real values.
Anyway, if you set that in the begining of your code, every "system"
you use will have these two variables exported as well.

Does this answer your question?

Filipe
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux