[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 487
  • Last Modified:

Automatically (and silently) FTP a file to me at boot up.

I own several stores. I would like it if when the the PC at a store is first booted up, it will FTP (or otherwise transmit) a file to me, at my home office. I run XP at my office, one store PC also runs XP, and the other store runs 98.

I would like it to be that the user would not see any program starting on the screen, nor would there be any need to shut the program down. It would be ok to have an icon in the system tray, if the program can run that way.

The file in question (if anybody is wondering) is the log of the previous days transactions. I don't want the manager to think that I am "checking up on him", but I do want to be able to remotely retrieve this information, on a daily basis.

Can this be done as a "scheduled task" with some program that I can install on all of the machines in question?

Thank you.
0
4gtek
Asked:
4gtek
  • 16
  • 8
  • 2
1 Solution
 
giltjrCommented:
Not sure if Windows 98 support is, but Window NT/2K/XP ftp command support the "-s:filename" option.  The filename is actually the commands to issue to ftp a file.  You could create a batch file that has:

     ftp -s:ftpcmd ftp.host.name 

or

    ftp -s:ftpcmd 1.1.1.1

where 1.1.1.1 is your home comptuer's IP address.

in the filename ftpcmd you would have the userid, password, followed by any commands need to get to the approprate directory and sent the needed file like:

     ftpuserid
     ftppassword
     cd incoming
     put c:\pgm\log\logfile.txt logfile.txt
     quit

you can have the ftp batch file execute at windows startup and/or have it scheduled on the task scheduler.

However, it may be better to find a free or inexpensive ftp server to run on Windows 98, then you pull the file on a daily basis.

0
 
4gtekAuthor Commented:
giltjr:
Thank you for your response-it seems promising; however I'm somewhat confused as to exactly what you're are suggesting. I have a few questions:

(1) Do I need to run an FTP program on my "home" PC, in order to receive the file? (I suspect so)
(2) You said "You can have the ftp batch file execute....."    What exactly is in the batch file, and where do I use the line:  ftp -s:ftpcmd 1.1.1.1? Is it also in the batch file? If so, where? And what do you mean by:
ftpuserid
ftppassword
cd incoming
put c:\pgm\log\logfile.txt logfile.txt  (I'm guessing this it the path to the file I want to send)
quit

It looks like I'll need just a little more explaining of what you suggested.

Also, will a cmd window or anything open up on the store PC, when the batch is executed?

Thanks
Larry
0
 
4gtekAuthor Commented:
Ok, I'm playing around with it and I'm starting to understand a little of it. (I think) Of course, I could be totally off base, I don't know.

Question # 1 still stands-What do I need to receive the file?

Here's what I've done so far to try to understand what you suggested:

I created a batch file called: FTPTEST.BAT. In it I wrote:
ftp -v -s:c:\TEXTFILE.TXT  XX.XX.XXX.XX
(where the Xs is the IP address of my broadband router-question on that later)

I then created 2 files on C:\, One  called: TEXTFILE.TXT and in that I wrote:
ftpuserid
ftppassword
cd incoming (I left this line out as C: was the current directory)
put c:\filetosend.txt filetosend2.txt
quit

And the second file I created on C:\ was called: filetosend.txt

My results so far: First, the -V switch doesn't supress the display of the command window, and second, I get a "Connection Closed by remote host".

Of course, I'm trying to send and receive it from the same PC-Maybe that's not valid. Tomorow I'll use 2 PCs at home, connected by my broadband router. Will I need to forward any ports for this to happen?

And, as I said at the top, do I need to run a FTP program in order to receive the file? If so, how do I set it up? And I'm guessing the ID and password lines in the .txt file will then be relevant.

Ok, if I'm totally in outer space, please let me know. (but at least I tried)

Thanks.
Larry
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
r-kCommented:
(Hope you don't mind if I intrude on this thread...)

Yes, you will need an "FTP server" on the receiving end.

There are many servers out there. One that I've used myself is WFTPD from:

 http://www.wftpd.com/

They used to have a free version that would let you transfer 5 files per session, and that may be enough for you. The paid version is only about $30, I think.

Re. you other questions, it will be tricky to get nothing displayed on the screen.

Re. forwarding ports, nothing is needed at the client (sender's) end, but you will have to allow FTP connection through your firewall, if any, at the server end, and you'll also have to do port forwarding if you are using NAT.
0
 
4gtekAuthor Commented:
Ok, I've got it going to the point where it connects to my FTP server, accepts the incoming connection, logs on ok (I tried it both as "Anonymous" and with a user ID and password, but never transfers the file. The server times out (default 100-I assume in seconds).

First I thought that the line in my text file:   put c:\filetosend.txt filetosend2.txt    was no good if it couldn't rename the file, so I took out the "2", but no difference.

I verified that the file exists on the C drive (It's just a "test" text file I created) so it should transfer imediately, but so far, no joy.

I specified a directory (I think) for uploads from this "user", and checked "Uploads" as a permission, but nothing transfers.

Any suggestions?
Thanks
0
 
r-kCommented:
A couple of questions:

(1) What FTP server are you using (WFTD??)

(2) If you are using the file as listed above, you must have a folder named c:\incoming on your server machine.

(3) It might be useful if you could post the contents of your textfile.txt file here again.

Thanks.

PS: I am leaving in a few minutes, so good luck.
0
 
4gtekAuthor Commented:
R-K
There's quite a few free FTP servers out there, unfortunately the one you suggested didn't seem to offer a free version (unless I missed it)

The program I selected: http://www.cerberusftp.com/ seemed super easy to set up, and "seems" to provide a directory (I think) called FTProot; to which I gave it upload and downoad permissions.

Here is my Textfile.txt:
anonymous
anonymous
put c:\filetosend.txt filetosend.txt
quit
0
 
4gtekAuthor Commented:
Still don't know where I'm going wrong.
Tried a new free FTP server program: http://www.pablosoftwaresolutions.com/html/quick__n_easy_ftp_server.html

At least I was able to use the same credentials in an FTP client program to transfer a file, but when using my text file from the command line, it always stops and times out without transfering the file.

I even tried changing the "Put" line to read:
Put C:\filetosend.txt    c:\ftproot\filetosent.txt    
I was thinking that I needed to specify the path on the server where the file would go (C:\ftproot) but still nothing.

I know I'm close-As I said I did manage to transfer a file using a gui ftp client, so I know that the server is working.

Does anyone know what (if anything) is wrong with my textfile.txt? (or my batch file:
ftp -v -s:c:\textfile.txt 68.81.204.xxx)

Maybe I should take the -V switch out, as it doesn't suppress the cmd window anyway.

Thanks.
Larry
0
 
giltjrCommented:
Hello,

Sorry have been out all day.  Try removing the -v, this suppreses the responses from the server.

Try issuing the same exact commands from a command prompt  inetad of using the text file and see what comes back.

That is go to a command promt and enter:

     ftp 68.81.204.xxx

you should get back a welcome message from the ftp server running on your computer and then a prompt for a userid, when you get the prompty for the userid, enter you userid.  Next you should get prompt for a password, enter your password.  Then enter the put command.  If the default root directory does not have write/upload (set within the configuration of the FTP server) then you need to change directory to the directory you created for uploading files to.   After you get this working by manually entering the command, you put all the command you enter in to the file "textfile.txt" and try ftp -s:textfile.txt

On the PUT command you should not need to specify the full path for the destination file.  The ftp server should be setup by default to have a "virtual root" and if setup properly will not allow you to specify a fully qualifed path, that is you can specify "put c:\source.file destination.file", but you can't specify "put c:\source.file c:\dir\destination.file".

You will need to verify that your ftp server is setup with at least one directory that has the write attribute enabled.

Once you get this working, please disable anonymous and setup a userid and password.  You do not want a ftp server open on the internet with anonymous enabled and write/upload capabilities.  You also do not want others to be able to download these files.
0
 
4gtekAuthor Commented:
I am able to log on both manually and with my batch file, but it always "hangs" on the PUT command.

Last night, however, I DID successfully transfer a file using both my textfile and using an FTP client, however today I can not. The problem is that so far, I'm not able to set up the directory that I want to see (from the FTP client), all I get is "/", and also I can't control (yet) where the file goes when I use the textfile.txt.

So somehow I took 2 steps forward, but one step back, as I can't get anything (other than the log on) to work now.

The program I'm using is called Quick 'n Easy FTP Server 2.7: http://www.pablosoftwaresolutions.com/html/quick__n_easy_ftp_server.html  and it seems extremely simple to set up-I even went with all the defualts. But somehow, when setting up a "user" and specifiying a "home" directory and/or a "virtual directory" (which I understand is not needed), nothing seems to work-but as I said, it did last night.

It should be noted that for some reason, my textfile.txt only seemed to work if the name of the file was NOT repeated on the PUT line. Maybe that means something, as I'm sure you wouldn't have told me to do it if it wasn't necessary, but that's the only way I got at least some results:

me
mypword
put c:\filetosend.txt
quit

Maybe someone can install this same server program and help me set it up. Meanwhile, I'll keep plugging away at it, hopefully I can at least get back to the point where it worked, but I couldn't control what directories I saw or used (on the server)

thanks, Larry
0
 
4gtekAuthor Commented:
Just tried to connect using a browser, both on the server PC, and another on my network.

It connects, but times out, saying that it can't find the folder-make sure I have permission to access that folder. So there is something definately wrong with my setup, but so far can't find out what.
0
 
4gtekAuthor Commented:
Making progress!
Turned off the Windows firewall, and now it works. (At least from the command line)

 I need to now know how to make an "exception" so I can turn it back on. I tried opening port 20 and 21, but that didn't work.
0
 
4gtekAuthor Commented:
New problem:
Now that I have it working (sort of) I wanted to set up the scheduled task so it would run on the "remote" machine at either boot up, or at a certain time.

The problem is, you can't set up a Scheduled Task without a user password! The machine(s) in question DO NOT have a user password in effect, so the scheduled task won't run.

Is there a way around this? There must be, as the Norton "NETDETECT" seems to run without a user password, as a scheduled event.
0
 
giltjrCommented:
Glad your making progress.

When you configure a user under Quick 'n Easy FTP Server the home directory is where that userid will be when it initially connects to the FTP server.  You could create a unique userid for each remote site, with each remote site having its how home directory.  This way if somebody at one site finds the batch file and figures out what is going on, they can only logon to your ftp server and see that sites files.  They can't see any of the other sites files.

On your PC when you are configuring the firewall, you need to go to the execption tab and check "File Transfer Program" (a.k.a. ftp).  This should allow your PC to act as a FTP server.

For Windows 98 you should not need a userid and password to schedule a task.  However under XP the task must run under a userid that is valid on the local machine or valid on the domain if it is part of a domain.  So you will need to know a userid and password that is valid on that PC.
0
 
4gtekAuthor Commented:
giltjr

Thank you for your responses.

I've pretty much "fought" my way thru learning the server, and inasmuch as I can't make a "Scheduled Task" on the remote XP machines; what I decided to do is install Quick "n Easy FTP Server on the remote machines, then I will manually download via FTP client program the file when I need it.

The nice thing about this server program is that it starts up (in XP) completetly silently, and with XP's ability to always hide the tray icon, it will not be noticed at all. It has in it's configuration setup the option to launch the program and start the service, and be minimized to the tray on startup, and as I said, XP will always hide the icon. I just hope it doesn't "Nag" for donations (it's free ware) occaisionally.

As for the Windows firewall, the situation is that I've been testing this setup at home, on 2 XP boxes, connected via broadband router with NAT. I forwarded port 21 to the "Server" in the router, but it seems the machine that will be the "client" won't allow the connection, unless I turn off the Windows firewall on that machine.

Of course, I could always just turn off the Windows firewall while I'm making the transfer, but it would be nice if I could set it so it allows it to work. There is an entry for my FTP client program in the "Exception" list, but so far it hasn't helped. I even tried the "Change scope" option, and entered the private IP for each machine, but no good there either.

So, if you have any ideas for fixing this last  (hopefully) loose end, I'd appreciate it. And if you have any comments about my plan to just install the server on the "remote" machines, I'd appreciate that as well.  

thanks, Larry
0
 
giltjrCommented:
When you have the windows firewall running what happens?  Can you connect to the remote server, but the transfer fails?

Windows firewall creats a log, by default this is C:\WINDOWS\pfirewall.log, you can verify where your log is by selecting the Advance Tab on the firewall configuration and look at the logging settings.

You should be able to look at this log and see what packets are being dropped that are from the FTP servers remote IP address.

0
 
4gtekAuthor Commented:
I can connect, but the transfer fails.
Here is the log: It is of the last connection attempt:
#Version: 1.5
#Software: Microsoft Windows Firewall
#Time Format: Local
#Fields: date time action protocol src-ip dst-ip src-port dst-port size tcpflags tcpsyn tcpack tcpwin icmptype icmpcode info path

2005-05-08 22:34:29 CLOSE TCP 192.168.2.100 66.92.235.130 2459 110 - - - - - - - - -
2005-05-08 22:35:08 CLOSE TCP 192.168.2.100 204.127.198.10 2458 110 - - - - - - - - -
2005-05-08 22:38:08 OPEN TCP 192.168.2.100 204.127.198.10 2462 110 - - - - - - - - -
2005-05-08 22:38:08 OPEN TCP 192.168.2.100 66.92.235.130 2463 110 - - - - - - - - -
2005-05-08 22:39:31 CLOSE TCP 192.168.2.100 66.92.235.130 2463 110 - - - - - - - - -
2005-05-08 22:40:10 CLOSE TCP 192.168.2.100 204.127.198.10 2462 110 - - - - - - - - -
2005-05-08 22:40:52 DROP UDP 0.0.0.0 255.255.255.255 68 67 340 - - - - - - - RECEIVE
2005-05-08 22:41:37 OPEN UDP 192.168.2.100 192.168.2.111 137 137 - - - - - - - - -
2005-05-08 22:41:37 OPEN-INBOUND TCP 192.168.2.111 192.168.2.100 1026 139 - - - - - - - - -
2005-05-08 22:41:37 CLOSE TCP 192.168.2.100 192.168.2.111 139 1026 - - - - - - - - -
2005-05-08 22:41:52 DROP UDP 192.168.2.111 255.255.255.255 68 67 328 - - - - - - - RECEIVE
2005-05-08 22:41:55 DROP UDP 192.168.2.111 255.255.255.255 68 67 328 - - - - - - - RECEIVE
2005-05-08 22:43:10 OPEN TCP 192.168.2.100 204.127.198.10 2464 110 - - - - - - - - -
2005-05-08 22:43:10 OPEN TCP 192.168.2.100 66.92.235.130 2465 110 - - - - - - - - -
2005-05-08 22:43:26 CLOSE UDP 192.168.2.100 192.168.2.111 137 137 - - - - - - - - -
2005-05-08 22:43:56 OPEN-INBOUND TCP 192.168.2.111 192.168.2.100 1032 139 - - - - - - - - -
2005-05-08 22:43:56 OPEN UDP 192.168.2.100 192.168.2.111 137 137 - - - - - - - - -
2005-05-08 22:44:09 OPEN UDP 192.168.2.100 192.168.2.111 138 138 - - - - - - - - -
2005-05-08 22:44:32 CLOSE TCP 192.168.2.100 66.92.235.130 2465 110 - - - - - - - - -
2005-05-08 22:45:11 CLOSE TCP 192.168.2.100 204.127.198.10 2464 110 - - - - - - - - -
2005-05-08 22:45:26 CLOSE UDP 192.168.2.100 192.168.2.111 137 137 - - - - - - - - -
2005-05-08 22:45:26 CLOSE UDP 192.168.2.100 192.168.2.111 138 138 - - - - - - - - -
2005-05-08 22:45:46 OPEN TCP 192.168.2.100 127.0.0.1 2466 1027 - - - - - - - - -
2005-05-08 22:45:46 OPEN TCP 192.168.2.100 68.81.204.164 2468 21 - - - - - - - - -

As I said it connects, goes all the way to "Host Type" (Unix Standard) then shows
Port 192.168.2.100,9,165
!Receive Error: Blocking call canceled

!Failed "Port"
!Retrieve of folder listing failed (0)

And that's as far as it goes. If I turn the Windows firewall off, it has no trouble.

Hope that gives you a clue.
Thanks, Larry
0
 
giltjrCommented:
O.K.

I need to think about this.  I know what is occuring, but I need to figure out how to explain to you want to do.

To summerize, ftp actually uses TWO ports.  On is 21 which is the "command" or control port.  This is what you use to logon to the ftp server and issue commands.  The other port is the data port, which is a second connection that is created when ever you issue certain commands (dir, ls, get, put, mget, mput are some examples) and this second connection is the connection that is used to actually transfer the data.

The second connection is the one that is getting blocked.
0
 
4gtekAuthor Commented:
I saw some mention of port 20 for data, in the various help files I read, if that helps.

And do we have to enable UDP ports as well? I see mention of UDP ports in the log.
Thanks.
0
 
giltjrCommented:
FTP does not use UDP.

Port 20 is the other FTP port,when using "active" transfer mode.  For "active" ftp transfers, the client will tell the server what port it is listening on via the "PORT" command.  In your example it was port 9165, however this is a random port, it will never be the same port two times in a row.  The ftp server will connect FROM port 20 to the random port that the client told it to use on the.

There is a passive mode for ftp, but the Windows ftp client does not support passive file transfers.

It almost looks like the Windows firewall is only logging traffic outbound from your PC and not both directions (in and out).  I was under the impression that enabling the ftp client on the windows firewall would cause the firewall to watch ftp commands and allow traffic on the port specified in the PORT command.  I guess I will need to read more on the Windows firewall to verify this.



0
 
4gtekAuthor Commented:
I installed the Quick 'n Easy Server on one store's PC tonight, but ran into a minor issue with the Windows firewall (again) on that PC. The program starts and seems to run ok, but when I tried to FTP into it from another PC at the same location, it wouldn't respond.

I knew right away that the problem was with the Windows firewall-as soon as I turned it off, I was able to get in. I thought that I could just "check it off" as an exception in the Windows firewall setup, but there was no entry for the program there. The funny thing about this program is that there is no "install" routine, you just click on the executable, and it runs. I guess it installs itself as a service????? It does restart automaticly on reboot (if that option is chosen) as I see there is an entry in the Startup folder. I tried to manually add the entry for the executable in the exceptions, but had no effect.

The strange thing is, that on my test box at home, It DID put an entry in the "exceptions" list and works ok with the firewall on. I don't know what I may have done differently-As I said, it really doesn't "install" itself. (NOTE: This is a different issue-not to be confused with my problem on the client side with Windows firewall)

So for right now, I left the Windows firewall off, and when the machine gets turned on tomorow morning, I'll see if I can transfer a file.
0
 
giltjrCommented:
I have taken a quick look (no pun intended) at this ftp.  It does not install, it is just the program.  I also do not beleive it is a service, but it only adds itself to the startup folder.  The difference is that a service will start when Windows is booted, things in the startup folder will only startup when somebody logs on to the PC.  The startup folder is also a "merged" folder from "all users" and your specific userid.  If it places itself in your startup folder, then it will only start when you logon, if it places itself in the "all users" folder, then it will start when any users logs on.

Let make sure I understand something.  On which PC are you turning off the firewall.  The one running Quick or the one where you issue the ftp command?

You do need to setup the firewall to all the PC that Quick is running on to allow it to act like a FTP server.  When configuring the firewall go to the advanced tab, select the network connection that you will use to do the ftp across, select settings, then check the box to allow FTP Server to function on that interface/connection.
0
 
4gtekAuthor Commented:
Sorry for the confusion-I'll try to explain better.

When I was testing the setup at home, originally I discovered that the machine with the "Client" would not connect to Quick Server unless the Windows firewall was turned OFF on the CLIENT PC. If you recall, I sent you the log, which you examined. That was Part "A".

Here is Part "B": Then, I installed a copy of Quick Server on yet another box at home, and discovered that I couldn't connect to it, unless I turned off the Windows firewall on THAT PC. (the server)

 I then examined the Windows firewall setup, and found an entry for "Quick 'n Easy FTP Server" in the "Exceptions" list, (on the server) and when I enabled it (checked it),  then I could connect to the server with the firewall enabled on the server, but still has to be OFF on the client.

As I said in my previous post, last night I went to one of the stores and installed the FTP server on an XP box, but found that I couldn't connect to it from the LAN if Windows firewall was enabled (on the SERVER). The machine on the LAN I was testing from is a ME box-no firewall on there at all.

So I imediately went to the exceptions list, but Quick server wasn't listed there! I don't know how it got an entry on the one box at home, but not on the work PC. I tried to manually enter the executable for the Server program, as well as creating a "Generic" entry called FTP with port 21 enabled, but neither had any effect. So I left the Firewall off. Somehow, it is interfering with the Server program.

Now here's the strangest part: The box at home (the second one I installed the Quick server on) NOW also won't work with the windows firewall turned on, EVEN with the exception checked off! I don't know what happened or what's different-I'm even sure I rebooted a couple of times on this box-it that mattered.

So to sum up: As it stands now, the setup at home will comunicate only if Windows firewall is turned OFF on both client and server. Enabling the firewall on either end stops all FTP comunications. (I haven't  tried to access the work machine, across the internet, as that PC is not turned on yet)

Windows firewall is turning out to be a real pain!

Another question (as if you didn't have enough to think about): Is there some way to ping a specific machine on the LAN (behind the router)? I can see from the router's log when the PC is turned on, but if it gets turned off, I have no way of knowing if it's on or off.

I guess what I'm asking is if a PING request can be "forwarded" to a specific PC behind the router.

Thanks.
BTW-Don't know if you noticed or not, I awarded the points-Many thanks for all the help so far.  And to "RK", thanks for the comment as well!
0
 
giltjrCommented:
I did notice points award and thanks.

A quick answer on the ping is, it denepends.  Some routers/firewalls allow pings (ICMP requests) to be foreward and some do not.  So it depends on what configuration options you have on the router/firewall  between the two computers.

Although I have some issues with MS, firewalls are designed to do this and its just MS interface for configuring the firewall is not really targeted for this.  I have issues with Zone Alarm personal also.

I run Linux on my personal comptuer and I only use Windows because my work says I have to.

What type of routers are you using at each location?
0
 
4gtekAuthor Commented:
I am able to ping the computers on the lan-the router has a function to do this, so now I can determine which computers are on, and when they're off-very simple, works great. At home, I have a SMC barricade router, and at the store it is a D-Link DI-604.

I too tried Zone Alarm personal firewall a while back-But it seemed as if there was an issue with it instigating non-stop hard drive activity. (I saw many posts about this issue). The PC would sit there and have constant drive activity for a long time, sit quiet for a while, then more activity for 5 or ten minutes.

As for the firewall issue, if you're out of ideas, then I'll just have to leave the firewall off on the store Pc, and turn mine on and off as needed. It seems rather odd that the Quick Server software won't work with the Firewall on, and even stranger is that the program was listed in the firewall's "exception" list on two of the 3 installs I did-if you call just clicking on the .EXE an "install"-which it seems not in this particular case.

The documentation for the program seems excellent, I'll study it more to see if I can uncover something.

Thanks
0
 
4gtekAuthor Commented:
Do "download accelarators" do anything? The download is very slow (133.65 kbps). Of course, I know I'm limited by the upload speed of the DSL service I have (128/768, I believe), but I'm not sure how the numbers are related. If the upload speed that I'm paying for (128) is also kbps, then according to the transfer window, it's already faster than it should be.

If on the other hand, it's a Kilo-bits vs. a Kilo-bytes "translation", then I'm not sure how the conversions work out. The transfer window showed (for example) that 10% of the 59, 859, 465 file (I asume that's in Kilobytes, as I know the file is approx. 59 megs in size) actually transfered in about 8 minutes.

Anyway, I looked at a free program called Winget http://www.indentix.com/winget.html but I'm not quite sure how to use it. It says that it "intergrates" with the browser, but I'm using a FTP client. It asks for the "URL" so I assume I use the FTP address (FTP: xx.xx. xx. xx) but then it asks for a file name. That's where I'm confused, as I'm not sure what to input there.

 Anyway, if it's claim of "splitting" the file up for faster downloads is not true, then I'll not even think about using it.

Thanks, Larry
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 16
  • 8
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now