FTP connection refused issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP connection refused issue
# 1  
Old 07-16-2013
FTP connection refused issue

Hi All,


I am using the below script to get some files from the remote location

Code:
 
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 error "Connection refused"

I am giving the right username , password and hostname. I dont have to apply the ssh-keys as i want to do it by giving password.
# 2  
Old 07-16-2013
Is FTP daemon running on your server ? Have you managed to connect and transfer the file manually ?
# 3  
Old 07-16-2013
Please find the following ftp script to download file from server.

=================================
Code:
HOST='Test03'
USER='user'
PASSWD='*****'
FILE='d.txt'
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
bin        
get $FILE
quit
END_SCRIPT
exit 0

=================================

First make sure you are able to download the file manually.

Also check if 'root' is allowed access to FTP.

Change the FILE variable from
Code:
FILE="/home/user/d.txt"

to
Code:
FILE='d.txt'


Note : If you don't use bin, you may get following warning.

WARNING! 1 bare linefeeds received in ASCII mode
File may not have transferred correctly.

Last edited by Franklin52; 07-16-2013 at 08:44 AM.. Reason: Please use code tags
This User Gave Thanks to snjksh For This Post:
# 4  
Old 07-16-2013
You don't say which Unix/Linux flavor this is but, talking generic Unix, since you are wanting to use ordinary ftp (along with the security issues that might give you) you can use a .netrc file to hold the remote login credentials. Google for .netrc

.netrc must reside in the home directory under which the command will run and have read access only for that user.

Once this is configured properly to can test it interactivley by typing the command:

Code:
 
ftp Test03

(using the node name in your script) and the ftp session should connect immediately if all is well. You can then write your script without userid/passwd concerns.

Hope that helps.
This User Gave Thanks to hicksd8 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

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... (8 Replies)
Discussion started by: samrat dutta
8 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. 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

8. 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

9. 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

10. SCO

telnet connection refused

I installed Openserver 5.0.7 and I cannot telnet to the localhost and I can't telnet from my old SCO 3.2.42 to the new SCO machine but I can ping the new machine and it will telnet to the old machine. (2 Replies)
Discussion started by: printrick
2 Replies
Login or Register to Ask a Question