ftp: Name or service not known

Hi All,

I'm a new user. When I try to use ftp in a script, its throwing the below error "ftp: Name or service not known".

what could be the issue??? Pls help.:wink:

Please show us your script - the part with the problems.

Halo jim mcnamara,

Pls find the script below.

HOST=XXXX
USER='USER'
PASSWD='PWD'
PATH=file/bak
ftp -n -i $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd $PATH
get file_name
bye
END_SCRIPT

Thanks in Advance....

  1. can you ping your remote host
# XXXX is not the real hostname
ping XXXX
  1. If #1 worked can you telnet to port 21 on the remote box?
telnet XXXX 21

IF you get something like this

Trying 10.128.3.251...
Connected to 10.128.3.251.
Escape character is '^]'.

it worked. Let us know.

1 Like

Thanks a lot for your quick revert.

The thing is, I'm able to ping/ ftp to HOST normally.

But inside the script, its not working.

Kindly Suggest.

$PATH is a reserved variable in Shell. Use another name for the variable!

By changing the value of $PATH you have stopped your script from being able to find "ftp" ... or for that matter any program which is not in "file/bak".

Dear Methyl,

I changed the variable name and even then No Go......

Once you fix the above suggestions and you fix your PASS/PWD variable it should work.

Pls help me...... Waiting for someone's suggestion.

Please post the current version of the script and mention what Operating System and Shell you are using.

The error message posted usually means that ftp cannot convert the name of the server to an IP address for some reason.
When you try ftp manually, are you on the same computer?