2

My Issue

I am trying to automate a file fetch from an external [SFTP] server. The server is using 2-factor authentication. First, it needs a public-private key pairing established [This has already been done], next, it asks for a password for login.

My Constraints

The server's settings are outside my control [Its a vendor system] and I would prefer not to install modules like expect or sshpass [company policy]. I can use PERL/KSH for automating the fetch, along with most applications that come pre-installed on RHL [CURL,WGET,etc].

Is there any way out of this?

  • 2
    I don't think so. You can probably code similar thing like expect or sshpass, but why? Two-factor authentication was made to increase security and storing both factors on the same place will boil back down to not-secure-at-all. – Jakuje Oct 12 '15 at 7:59
  • Change that weird policy. – sebix Oct 12 '15 at 8:27
  • @Jakuje : We need to automate the transfer, this is one among several files that we fetch, the rest of which are already automated [None of the rest require two-factor authentication]. – onejerlo Oct 13 '15 at 8:53
  • @sebix : I wish I could, but this is a small change and the leadership would be none too happy installing modules just for this. – onejerlo Oct 13 '15 at 8:53
0

Test if you can simply provide the password for the 2nd prompt via stdin.

If that doesn't work then you have little choice but to use an expect-type solution. Since you're allowed to use Perl, you should be allowed to use Perl modules

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.