WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> Plugins >> SFTP Certificate Based authentication
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1493356747

Message started by Zack Baraci on Apr 28th, 2017 at 7:19am

Title: SFTP Certificate Based authentication
Post by Zack Baraci on Apr 28th, 2017 at 7:19am
Wondering if there is any ETA on the ability to do certificate based authentication from the watch dir FTP plugin?

Title: Re: SFTP Certificate Based authentication
Post by Gert on Apr 29th, 2017 at 5:51am
Hello Zack,

We plan to start work on a major release (version 5) soon. However we foresee this will be a lot of work and do not expect v5 to be released soon, likely late this year or early next year. v5 will implement private key logins for SFTP connections (among a lot of other things).

I believe some of our customers use the "Run any program" task with a command-line SFTP client to upload.

Gert

Title: Re: SFTP Certificate Based authentication
Post by Zack Baraci on May 1st, 2017 at 3:16am
I have had a go at this but am not able to get watchdir to work.  A batch file i have works when run by itself.  But when launched from watchdir it does nothing. so i am not sure whats going on there.  I will update watchdir as i need a new version for another issue i have.

Title: Re: SFTP Certificate Based authentication
Post by Zack Baraci on May 1st, 2017 at 3:26am
I tries something like this

pscp.exe -i <keyfile> -sftp "%WD_FILE%" <username@address>:/incoming
move "%WD_FILE%" /backupdir

If i ran this outside of watch dir it would work.  Obviously without the watchdir varables.  But it would just remain stuck on waiting on program and timeout after the timeout period so no idea why its hanging.

Title: Re: SFTP Certificate Based authentication
Post by Zack Baraci on May 1st, 2017 at 4:30am
It triggers the script but nothing from the script at all runs.  It makes no sense to me.

on 4.8.7 version.

watrchdir_cap.PNG (5 KB | 40 )

Title: Re: SFTP Certificate Based authentication
Post by Zack Baraci on May 1st, 2017 at 5:54am
Ahh interesting.  It seems you can't run this as a service as it will not do anything when run as a service.  If you choose to run manually it works fine.  I chose to run as startup for all users.  The question is will this persist through restart of system or will it need manual startup?

Title: Re: SFTP Certificate Based authentication
Post by Gert on May 1st, 2017 at 8:03pm
Hello Zack,

Sorry for the late reply.
You may want to read this: http://blog-en.gdpsoftware.com/2010/04/watchdirectory-tasks-as-windows-service.html

Services have (by default) limited access on the network.

If you "run a batch file" tasks, logs of output are at
"Tools -> Explore Task Directory"
then click the subdirectory with the name of your task.
Make sure your script does not have "ECHO OFF" obviously.

Title: Re: SFTP Certificate Based authentication
Post by Zack Baraci on May 2nd, 2017 at 2:34am
Seems nothing happens at all when run as service not even a log file is geneated.  Only works when run normal.  All assets are local on the machine but it simply does not even launch the batch file as service.

Will have to run it as an active task. :(

Title: Re: SFTP Certificate Based authentication
Post by Gert on May 2nd, 2017 at 6:10am
Can you rename your script to txt and post it here so I can have a look? Obviously change passwords etc.

A few things....
Never assume a certain working directory in your script. When a task runs as a service, depending on the Windows version, it typically is C:\Windows\System32. When run "normal" I think it is the monitored directory.

Always use full paths to files.

Always enclose filenames in "quotes".

Title: Re: SFTP Certificate Based authentication
Post by Dirk on May 2nd, 2017 at 8:47am
Hi Zack,

make sure that the user the service is running has read/writes rights to all needed folders. Make also sure that he is allowed to log on as service, see here: https://technet.microsoft.com/de-de/library/cc794944(v=ws.10).aspx

Do not place your script or log file direct on the desktop, use a temp foldr with correct rights instead.

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.