Hi,
I notice this is your first post (as a registered user).
If you have not done so I would suggest reading PerlMonks FAQ and How do I post a question effectively?.
It sounds like you want to connect to another host via telnet, then ftp from there to another server.
Net::Telnet would be the module to look at for connecting via telnet. However, considering that you will be sending data as plain text when using telnet (and that you are sending ftp username and password) I would suggest looking at Net::SSH.
Once you have connected to the target server (hopefully by SSH) you can issue commands to ftp on the remote server.
Should you need help installing moduled read the tutorial pertinent to your OS.
Hope this helps.
Martin | [reply] |
Hi Martin
Thank you very much for the quick reply.
Yes this is my first post and sorry for the ignorance.
I can only use telnet not ssh unfortunately.
I agree that this is unsafe but its all i can work with for now.
I have tried to ftp from within the telnet session, but to no avail.
Please could you suggest something.
PS: i am using linux.
Kind Regards
Spyda
| [reply] |
| [reply] |
As rev_1318 has already pointed out, you can probably use Net::FTP, but that assumes that you're trying to move files from/to the local system (which would be the web server, as you mentioned this is getting triggered from CGI)
The most useful thing at this point would be to take a step back, and in simple terms, try to explain to us what you are doing. (part of that whole thing that marto was indirectly suggesting, when he told you to read How do I post a question effectively?)
You have more knowledge about your problem than you're told us -- what you're trying to accomplish, the number of systems involved, etc.
Although it's possible to use waitfor() in Net::Telnet as you might use Expect, and then script your FTP connection through that, there might be an easier way -- we just need to know what the parts of the puzzle are that we're trying to deal with, so that you can accomplish your task.
| [reply] |
Hi,
Sorry i was just so excited about getting replies ;)
Okay ..
I have created a script to telnet into a remote server and ftp from that remote server. (this would be tier1)
I would also need to telnet from the tier1 server to another server (tier2) and ftp that same file to the tier3 server.
I am able to telnet in telnet, that works fine .. it is just the ftp'ing that i am having hassels with.
Thank you so very much for your replies ;)
Regards
Spyda
| [reply] |
Maybe I'm reading your message incorrectly, but your labeling of the systems seems rather confusing (is tier1 the webserver running the CGI, or the host that you're telneting to?)
I'm going to go with the assumption that you're dealing with:
- tier1 : webserver, running the CGI.
- tier2 : allows telnet from tier1, has the file of interest.
- tier3 : allows ftp from tier2, needs the file of interest.
Given that, I'd go with one of the following:
- Continue on with the processes that you've started. Basically, you'd use the same 'waitfor' and 'print' in Net::Telnet to send the necessary commands to transfer the file between tier2 and tier3. If available, I'd recommend looking into using scp over FTP, just because the command is more easily scriptable. (rcp is another possibility, if security isn't an issue). You might also look into Expect for some better error handling in the connection
- If tier2 has FTP or some other form of file transfers available, and tier3 allowed FTP in from tier1, and the file is allowed on the network connected to tier1, I'd use Net::FTP to pull the file from tier2 to tier1, then push it up to tier3.
- If tier2 and tier3 allowed scp in from tier1, I'd use it instead (I've never used it to move between two remote systems, but the man page seems to suggest that's possible)
| [reply] |