SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Problem with Secure FTP

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Problem with Secure FTP
Author Message
iqbal



Joined: 16 Sep 2010
Posts: 56

Post Problem with Secure FTP Reply with quote
We have installed 24x7 Multi-platform edition version 4.3 Build 293 on an XP machine. We could successfully use FTP. However, when we tried SECURE FTP the job exits without doing FTP. On the other hand if we comment the following then things are working.

FTPConfig "FTP PROTOCOL", "SECURE"

Let me attach the code for your reference

////////////////////////////////////////////////////////////
// 24x7 Scheduler Multi-platform Edition Version 4.3 Build 293
// Job Template: FTP download (using file mask)
// Generated on Thu Oct 14 14:51:06 GMT+04:00 2010
////////////////////////////////////////////////////////////

Dim file_list, string
Dim short_file_name, string
Dim ftp_file_name, string
Dim local_file_name, string
Dim no_more, boolean

onerrorstop

//FTPConfig "FTP PROTOCOL", "SECURE"


// Search files on FTP server.
FTPDir "xxx.xx.xx.xx", "username", "password", "/usr/local/24x7_Scheduler/readme.txt", file_list

messagebox file_list

isEqual file_list, "", no_more
IfThen no_more, DONE

// Download file(s) from FTP server.
LoopUntil no_more, END_LOOP
GetToken ",", file_list, short_file_name
Concat "/usr/local/24x7_Scheduler/", short_file_name, ftp_file_name
Concat "c:\\", short_file_name, local_file_name
FTPGetFile "xxx.xx.xx.xx", "username", "password", ftp_file_name, local_file_name

isEqual file_list, "", no_more
END_LOOP:

DONE:
Thu Oct 14, 2010 7:00 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7951

Post Reply with quote
For the secure FTP to work, it must be supported both by the client (24x7) and server (your FTP server). FTP servers typically support only one protocol based on their configuration.

By the way, there is a better way to handle all types of FTP in the Multi-platform version. The version you are running is not the recent. Please install version 4.4, which supports FTP, FTPS, and SFTP, and use JavaScript based jobs for secure FTP operations.
Thu Oct 14, 2010 4:44 pm View user's profile Send private message
iqbal



Joined: 16 Sep 2010
Posts: 56

Post Reply with quote
We will try version 4.4. By the way, what do you mean by FTP servers? Server machines dedicated only for FTP? Or any machine running FTP daemon? Please let me know
Mon Oct 18, 2010 3:11 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7951

Post Reply with quote
Hi,

By FTP servers we mean FTP server software packages. Each system may have 1 or more FTP servers running on different ports. Most Unix systems have FTP daemon preinstalled, which is a sort of FTP server running as a Unix server service. Windows systems also often have FTP servers as part of IIS installation. Many other FTP servers are available as commercial and as free packages from many vendors.
Mon Oct 18, 2010 9:37 pm View user's profile Send private message
iqbal



Joined: 16 Sep 2010
Posts: 56

Post Reply with quote
Thanks for the reply.

Could you please paste here a sample script for Secure FTP written in javascript ?
Thu Oct 21, 2010 5:16 am View user's profile Send private message
SysOpJ



Joined: 20 Aug 2010
Posts: 95

Post Reply with quote
The javascript doc file has many examples of ftp commands, http://www.softtreetech.com/24x7/24x7JavaScript.pdf

However, here's an example of a secure ftp connection getting a couple of files:

var server = "my server";
var user = "test";
var pass = "1111";
FTP.config("FTP PROTOCOL", "SECURE")
FTP.getFile(server, user, pass, "1.txt", "e:\\1.txt");
FTP.getFile(server, user, pass, "/pub/INSTALL", "e:\\INSTALL");

Have you confirmed that your FTP server supports and is configured to use SFTP, and are you able to connect with an SFTP client?
Thu Oct 21, 2010 6:57 am View user's profile Send private message
iqbal



Joined: 16 Sep 2010
Posts: 56

Post Reply with quote
I tried to run the following code

var server = "xxx.xx.xx.xx";
var user = "username";
var pass = "password";
FTP.config("FTP PROTOCOL", "SECURE")
FTP.getFile(server, user, pass, "pathnameofthefile", "c:\\1.txt");

We got the following error:

"An error occurred while executing automation script: Line 5: Connection to FTP server xxx.xx.xx.xx failed. FTP server returned error:"

Yes, SFTP is configured on our UNIX machine and we are able to use the client tool PSFTP.EXE to get files from unix machine to a windows machine. From the above code if I comment FTP.config("FTP PROTOCOL", "SECURE") , it works!
Fri Oct 22, 2010 11:19 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7951

Post Reply with quote
If your server supports both FTP and Secure FTP protocols, it must be listening on different port numbers for different protocols. Default port number for FTP is 21, that's what 27x7 uses by default. In case your FTP server supports secure protocol based on SSH (often called SFTP), the default port number should be 22, and in case it supports FTP over SSL (often called FTPS), the default number is 990

Assuming that your server supports more common SFTP, try adding the following line
FTP.config("PORT", "22")


All together
Code:
var server = "xxx.xx.xx.xx";
var user = "username";
var pass = "password";
FTP.config("FTP PROTOCOL", "SFTP") ;
FTP.config("PORT", "22");
FTP.getFile(server, user, pass, "pathnameofthefile", "c:\\1.txt");

Fri Oct 22, 2010 9:40 pm View user's profile Send private message
iqbal



Joined: 16 Sep 2010
Posts: 56

Post Reply with quote
Thank you.

SFTP is working now after adding the line
FTP.config("PORT", "22")
Sun Oct 24, 2010 12:09 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.