473,480 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ftp from unix to windows - urgent help required

1 New Member
I'm trying to ftp from a Unix machine to a Windows machine..

I've tried the following

#!/bin/sh
#set -x
USER="user1"
PASS="pass1"
HOSTNAME="host1"

ftp -n -i -v $HOSTNAME << EOT
user $USER $PASS
cd /
send text1.txt
close
bye
EOT

When I try to run this, I get prompted for the password. But since this will be working in a Production environment and run by people who have no idea what this script will be doing , the process should be automated. The user id and password have to go in automatically and the file should be put in.

I've tired different options like
ftp -n -i -v << EOT
open $HOSTNAME
$USER
$PASS
cd /
send text1.txt
close

as well as
ftp -n << EOT
open $HOSTNAME
quote USER $USER
quote PASS $PASS
cd /
send text1.txt
close

but always I keep getting the same error, where I'm prompted for the password.

Output when running script
----------------------------------
****
Connected to host1
220 FTP server (Hummingbird Ltd. (HCLFTPD) Version 9.0.0.0) ready.
331 Password required for user1
***

This is kind of urgent. Any help would be greatly appreciated.

Thanks
Sam
Sep 4 '07 #1
2 13937
diSangro
69 New Member
I've used in csh script the following (ftp session should be the same):

Expand|Select|Wrap|Line Numbers
  1.  
  2.       ftp  -i -n -v <<End
  3.       open <ipaddress>
  4.       user <usr_name> <pwd>
  5.       lcd $SOURCE_DIR
  6.       cd $DEST_DIR
  7.       binary
  8.       put $FNAME
  9.       close
  10.       bye
  11. End
  12.  
It works on Solaris!

diSangro

I'm trying to ftp from a Unix machine to a Windows machine..

I've tried the following

#!/bin/sh
#set -x
USER="user1"
PASS="pass1"
HOSTNAME="host1"

ftp -n -i -v $HOSTNAME << EOT
user $USER $PASS
cd /
send text1.txt
close
bye
EOT

When I try to run this, I get prompted for the password. But since this will be working in a Production environment and run by people who have no idea what this script will be doing , the process should be automated. The user id and password have to go in automatically and the file should be put in.

I've tired different options like
ftp -n -i -v << EOT
open $HOSTNAME
$USER
$PASS
cd /
send text1.txt
close

as well as
ftp -n << EOT
open $HOSTNAME
quote USER $USER
quote PASS $PASS
cd /
send text1.txt
close

but always I keep getting the same error, where I'm prompted for the password.

Output when running script
----------------------------------
****
Connected to host1
220 FTP server (Hummingbird Ltd. (HCLFTPD) Version 9.0.0.0) ready.
331 Password required for user1
***

This is kind of urgent. Any help would be greatly appreciated.

Thanks
Sam
Sep 5 '07 #2
docdiesel
297 Recognized Expert Contributor
Hi,

I tried this, too, some time ago, and ended up with the very same problem. As far as I learned from this tests, ftp on the Linux installations I know doesn't like passwords from files, pipes or other streams. As soon as it detects that there's a TTY/console to interact with you, it will ask for a pwd. But I didn't try calling it via cron.

Btw., ever thought of transfering files/data automatically with ssh or rsync?

Regards, Bernd
Sep 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

22
3040
by: Ryan M | last post by:
I've been programming for a while, but most of my experience is on unix. How do C compilers work on operating systems that weren't written in C? And that have no libc? Compiling C on unix seems...
48
2543
by: Daniel Rudy | last post by:
Hello, On a x86 machine, what is the format of a pointer in C? I know for a fact that the x86 p-mode uses a /selector:offset/ notation where the selector is defined in either the GDT or LDT. ...
28
2996
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
10
1657
by: emmitsuks | last post by:
Can I compile C source in an PC editor like Miracle, build it, and then take that .exe over to Unix and run it there? Is there a preferred group for beginners such as myself to join?
3
1717
by: Pradeep | last post by:
Hi friends, We are changing the python application from Unix to Windows. The source code of Python application should work well in windows. How to make changed to windows environment. In Python...
15
7041
by: =?Utf-8?B?TVNU?= | last post by:
To demonstrate my problem, I have a very simple VB Windows application. It has a text box that is used to display a counter, a button to reset the counter, and a timer that increments the counter...
4
5741
by: Christian Maslen | last post by:
Hi All, I understand in older versions of DB2/UDB this was not possible. The following article explains how I might do this ...
0
13283
amitpatel66
by: amitpatel66 | last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations: Concurrent programs can be executed...
0
6920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7059
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6758
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4499
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3011
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3003
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.