Subject: | username precedence |
The document on "username" states:
The username to use to log in to the remote server. This should be your
SSH login, and can be empty, in which case the username is drawn from
the user executing the process.
I found that the username set in ~/.ssh/config takes precedence.
So, even if I specified "\"user\"=>different_user", it did not work. It
always defaulted to ~/.ssh/config.
This is not how SSH is supposed to behave. SSH aka SFTP always takes the
precedence specified and only uses ~/.ssh/config when it is not
specified.
However, if you argue that this is normal behavior, then it should be
stated as such in the document. Although, I would disagree, because if I
developed a perl sftp script on a dev machine and then passed the script
to a production machine and the production machine had specified these
values, then my script would fail to override these settings. I.E
./script.pl -user otheruser -pass secret -host example.com (would not
work)
This is perl, v5.8.8 built for x86_64-linux-thread-mult
perl-Net-SFTP-0.10-1.el5