Operating System - HP-UX
1834261 Members
35799 Online
110066 Solutions
New Discussion

netrc Password Prompt Problem

 
SOLVED
Go to solution
Mark Duffy
Advisor

netrc Password Prompt Problem

Hi all,

I'm trying to ftp a file and wanting to use netrc to do this. My script is failing because it is looking for manual prompt at the login stage of ftp and I can't seem to find a way to this shut this prompt off. Any ideas anyone? Script is as follows:

#!/bin/ksh
cd /tmp

echo "machine y.y.y.y login xxxx password xxxx macdef init" > netrc
echo "cd /techsup/demon/sysinfo" >> netrc
echo "prompt off" >> netrc
echo "put demoninfo*" >> netrc
echo "quit" >> netrc
echo >> netrc

mv netrc /.netrc
chmod 600 /.netrc
ftp 195.99.161.11
rm /.netrc

When I run thus I get the
NAME (hostname:user):
ftp prompt which is looking for a manual entry??
3 REPLIES 3
Paula J Frazer-Campbell
Honored Contributor

Re: netrc Password Prompt Problem

Hi

This automatic unattended ftp routine should do what you require.

ftp -n user
prompt
put
quit
End_of_Ftp


HTH

Paula
If you can spell SysAdmin then you is one - anon
John Palmer
Honored Contributor
Solution

Re: netrc Password Prompt Problem

Hi,

Instead of using .netrc, why don't you try the following:-

ftp -n << EOD
user
cd ...

quit
EOD

This definitely works ok.

Regards,
John
Kofi ARTHIABAH
Honored Contributor

Re: netrc Password Prompt Problem

I suspect that this might be a name resolution issue. the name specified in machine (must resolve) and the IP address must reverse resolv to the same name. If you are using IP addresses only, maintain all references to host as IP addresses. If you are using names, make sure that the names resolve to the same either way ie.:

host is not the same as host.domain.com
nothing wrong with me that a few lines of code cannot fix!