Do you know where your variables are? | |
PerlMonks |
Re^3: Preferred authentication in Net::SFTP::Foreignby salva (Canon) |
on Feb 10, 2016 at 09:00 UTC ( [id://1154820]=note: print w/replies, xml ) | Need Help?? |
This is handled correctly by SFTP without any special commands or configuration.Yes, except for the case where you want the password passed automatically, right? Could you please share what exactly was being addressed by the override As I toll you in my previous post, PreferredAuthentications is overriden in order to have a more controlled authentication process. Once ssh is launched there is no generic, reliable way to detect that authentication has succeeded and that the SFTP protocol can go on. For instance, one case that we have to handle is when the user wants to perform password authentication but for some reason it has also a proper authorized key. With the default PreferredAuthentication, ssh authenticates using the key and never goes to request the password, while Net::SFTP::Foreign hangs there waiting for the password prompt to appear. For your particular case, if you just use a convenient value for PreferredAuthentication, doesn't it work? For instance:
In any case, note that if you pass a password to the constructor it will wait for the password prompt to appear, and if it authenticates by other method it will hang there until the timeout expires and then it will close the connection and return an error. If what you need is optional password authentication, it is better to go looking into my other module Net::OpenSSH (which can be used with Net::SFTP::Foreign). It doesn't support that feature yet, but it could be done reliably there.
In Section
Seekers of Perl Wisdom
|
|