FTP connection refused


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP connection refused
# 1  
Old 05-30-2013
FTP connection refused

Hi I am trying to execute a shell script which is in unix server gs1. The script is below which basically connects to another unix server q15 and tries to get a file using FTP .
But i get error as "ftp: connect: Connection refused
Not connected.
Not connected."

Please help with if the below script has any flaw
Code:
#!/bin/ksh
HOST=q15.dev.com
USER=sam
PASSWD=sam
FILE1=/common/PDS/xyz.psv
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
lcd /app/daily/scripts
get $FILE
quit
END_SCRIPT
exit 0

regards
Sam

Last edited by Scott; 05-30-2013 at 12:07 PM.. Reason: Code tags, please...
# 2  
Old 05-30-2013
Are you able to manually ftp to the other server?
# 3  
Old 05-30-2013
If tha answer to fpmurphy's question is an affirmative, disregard what follows.

Your error message suggests that the FTP server cannot connect to the client machine, which it needs to do for normal (active) FTP. This is usually the result of the client being firewalled. You may have better luck using passive mode.

Regards,
Alister
# 4  
Old 05-30-2013
I just checked that normal FTP is not allowed and it should be sftp. I never tried. Can anyone help me to modify the above script i posted with how to make it work for sftp ?
# 5  
Old 05-31-2013
sftp is not a drop-in replacement for ftp, it does some things very differently, especially passwords. You will need to arrange passwordless login if you want to script it. Just having the right files in the right places lets automatic login happen.

Then you can just ignore the password part and do
Code:
sftp username@host <<EOF
lcd /app/daily/scripts
get $FILE
quit
EOF

# 6  
Old 06-03-2013
I thought that in-line commands were not allowed for sftp and that one always has to put the commands in a file and refer to them with the -b file. Of course, this might vary depending on the OS. I would expect something more like:-
Code:
echo "lcd /app/daily/scripts
get $FILE
quit"
> sftp.cmds

sftp -b user@server

Have I missed something?


Robin
Liverpool/Blackburn
UK
# 7  
Old 06-03-2013
Quote:
Originally Posted by rbatte1
I thought that in-line commands were not allowed for sftp and that one always has to put the commands in a file and refer to them with the -b file. Of course, this might vary depending on the OS.
It may indeed vary on the OS, since I have not encountered that restriction myself.
This User Gave Thanks to Corona688 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP connection refused issue

Hi All, I am using the below script to get some files from the remote location HOST='Test03' USER='root' PASSWD='*****' FILE='/home/user/d.txt' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD get $FILE quit END_SCRIPT exit 0 But ist is giving me the... (3 Replies)
Discussion started by: sharsour
3 Replies

2. AIX

FTP connection refused from text editor while accessing AIX server .

HI , I'm facing the FTP connection refused from text editor while accessing AIX server .It showing the messege "can't create ftp connection connectin refused".Though it is accessible from putty . i'm using aix version 6 . Can any one let me know the seetings needs to be made so that i... (2 Replies)
Discussion started by: rmkganesh
2 Replies

3. Debian

ftp connection refused

I have two computers running Debian 6.0 and one running Solaris 2.6 on a private network. The Debian computers can ftp to the Solaris computer but if a Debian computer is the destination the ftp connection is refused. I assume this is some security feature of Debian. What can I do to allow... (2 Replies)
Discussion started by: snorkack59
2 Replies

4. Solaris

ftp connect connection refused solaris 11

hi, I am using solaris 11 , facing problem in ftp while using ftp to connect it from other os. SCP and ssh are working fine. sftp also working from other solaris machine but i want to ftp from windows os which show me the below message. ftp connect connection refused I use below command... (3 Replies)
Discussion started by: zeeshan047
3 Replies

5. UNIX for Advanced & Expert Users

ftp connection refused

Hi- While trying ftp from AIX to Windows im getting below error. Can anyone share ur views on this topic. root@AB101# ftp -n 10.192.168.68 ftp: connect: A remote host refused an attempted connect operation. ftp> Thanks. (3 Replies)
Discussion started by: yanis
3 Replies

6. Solaris

Solaris 10 ftp connection problem (connection refused, connection timed out)

Hi everyone, I am hoping anyone of you could help me in this weird problem we have in 1 of our Solaris 10 servers. Lately, we have been having some ftp problems in this server. Though it can ping any server within the network, it seems that it can only ftp to a select few. For most servers, the... (4 Replies)
Discussion started by: labdakos
4 Replies

7. Programming

echo: Connection refused

OS : Solaris sparc In c program After socket created when I do Connect() it results "Connection refused", but the system is online and I am able to do telnet, ping everything, but it says connection refused. What would need to correct ? (6 Replies)
Discussion started by: satish@123
6 Replies

8. HP-UX

FTP large files - Getting "Connection Refused"

Hello Friends, When i trying to transfer a huge amount of files via FTP to a HP-Unx server, I am getting an error "Connection Refused"...! How can i avoid this error. Regards, Prakash K:b: (4 Replies)
Discussion started by: bullz26
4 Replies

9. IP Networking

Connection refused

Hi there, Anything will help. I have running server on computer and want to connect from some clients. Server: memset(&hints, 0, sizeof(hints)); hints.ai_family = domain; hints.ai_socktype = SOCK_STREAM; error = getaddrinfo("localhost", "8300", &hints, &res0); if (error) { ... (1 Reply)
Discussion started by: Dudu1984
1 Replies

10. Shell Programming and Scripting

Connection refused to ftp from a unix server to a windows pc

I need your help please. In order to run a script after a ftp connection, ive got initially this problem: from unix pc machine to a Unix server i could ftp succesfully but in reverse (i mean from unix to pc machine i cant ftp. The error message is this ftp 192.168.29.90 ftp: connect: Connection... (1 Reply)
Discussion started by: alexcol
1 Replies
Login or Register to Ask a Question