login about faq

I'm using ChilkatDotNet2.dll to connect to a sftp server, the connection to the server is established but the authentication fails when it is run automatically. if we run the script manually it works.

here is the part of the script I'm having trouble with.

$sftp is a new Chilkat.SFtp object. The other variables have hardcoded values earlier in the script and contain server information and user login/pass.

    $tryCount = 0
    do {
    $successCon = $sftp.Connect($sftpHostname,$sftpPort)
    if ($successCon -eq $true){
        $successAuth = $sftp.AuthenticatePw($sftpUser,$sftpPass)
        if ($successAuth -ne $true){
            $sftp.Disconnect()
        }
    }
    $tryCount++
    }
    while(($successCon -ne $true -or $successAuth -ne $true) -and $tryCount -le 3)

As I said, there is an automated task manager that executes scripts at certain times of the day automatically, and when they are automatically run, this script fails to pass the $sftp.AuthenticatePw check, but if I run the script manually, it works. Can anyone point me in the right direction as to what might be wrong?

asked Apr 17 '14 at 15:33

mmeopn's gravatar image

mmeopn
1111


usually a permissions problem, make sure the scheduled job User has appropriate permissions and that the ports are accessable.

link

answered Apr 18 '14 at 11:45

cdlvj130's gravatar image

cdlvj130
12691118

While your question is 2 years old, I am currently experiencing the same problem. I suspect the problem is that there doesn't appear to be a mechanism to accept the server key that it sends back when trying to authenticate. When using POSH-SSH, it has a parameter on the function that is AcceptKey which causes the command to accept the key provided by the server to authenticate it. I can't figure out how to do this with ChilKat. I suspect that when you are testing manually, you are using an account where something like FileZilla was used to connect to the site and when prompted for the key, you checked the box and accepted it (thereby saving it in your profile). Then when you run the script manually, it is seeing this saved key and it works. But on the automated run, the account the is running it hasn't done this previously so it is choking on the server authentication key that is being sent. If you log in as your automation account and do a manual connection with FileZilla or the like and accept and save that key, it should work as a workaround. But the proper way would be a method to do it programmatically. How did you end up solving it?

link

answered Mar 27 at 10:11

cjpalmer's gravatar image

cjpalmer
1

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×215
×3

Asked: Apr 17 '14 at 15:33

Seen: 1,197 times

Last updated: Mar 27 at 10:11

powered by OSQA