Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Specifying identify file with Net::SCP

by Mutant (Priest)
on May 12, 2006 at 14:56 UTC ( #549019=perlquestion: print w/ replies, xml ) Need Help??
Mutant has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

Is it possible to specify an identity file when using Net::SCP? I think it uses the default (whatever keys it can find in $HOME/.ssh) but I'd like to use a key file in a different dir.

Thanks.

Comment on Specifying identify file with Net::SCP
Re: Specifying identify file with Net::SCP
by socketdave (Curate) on May 12, 2006 at 15:13 UTC
    Net::SCP just wraps the scp program on your system. There doesn't seem to be a way to give options ( -i identify_file here ) to the actual scp binary. There is a $flags variable in the module itself that could be modified to do this, but that would be a bit nasty. Maybe better to modify the module to accept scp options and send a patch back to the author?
Re: Specifying identify file with Net::SCP
by andyford (Curate) on May 12, 2006 at 16:29 UTC
    Assuming that your identity file name stays constant, the quick and easy way would be to specify your alternate id file in your ~/.ssh/config file.

    You can do this on a per-host basis.

    Something like

    Host Box1 IdentityFile /home/goober/.sshalt/id-alt1
Re: Specifying identify file with Net::SCP
by idsfa (Vicar) on May 12, 2006 at 18:03 UTC

    Perusing the source, it looks like the command to be executed can be modified:

    use Net::SCP; $Net::SCP::scp = "scp -i $identity_file"; $scp = Net::SCP->new( "hostname", "username" );

    Ultimately, the flag handling should be rewritten in the module to allow full functionality ...


    The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://549019]
Approved by monkfan
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2014-10-22 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (113 votes), past polls