Subject: | config file overrides method parameters |
When using this module through Net::SFTP, I call it as:
my $connection = Net::SFTP->new(SERVER_IP,
user => USER,
debug => DEBUG,
ssh_args => {
port => PORT,
debug => DEBUG,
identity_files => [ IDENTITY_FILE ],
use_pty => 0,
protocol => '2',
});
but since I have something like the following in my ~/.ssh/config:
Host SERVER
User root
HostName IP-ADDRESS
Port XXXX
ServerAliveInterval 120
The "User root" from the config file seems to override the username
passed to SFTP. The end of the output from a failed attempt with debug
turned on is:
ws-deb-dev2: Will not query passphrase in batch mode.
ws-deb-dev2: Authentication methods that can continue: publickey,password.
ws-deb-dev2: Next method to try is publickey.
ws-deb-dev2: Trying pubkey authentication with key file 'name of private
key file'
Received disconnect message: Too many authentication failures for root
at /usr/local/share/perl/5.8.8/Net/SSH/Perl/AuthMgr.pm line 142
I added the following parameter:
user_config => '/dev/null',
to avoid this and it worked.
Usually, I expect parameters passed to a function to override any config
file that it might read. Instead, with the current version I have to
look through all the parameters and "reset" them to a sane value.
Thanks.