Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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:


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.


Comment on Specifying identify file with Net::SCP
Replies are listed 'Best First'.
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
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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2015-10-09 09:01 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (236 votes), past polls