I know the behaviour can vary between client implementations of ftp... (and so in what you should have in .netrc ...) look at the man pages of your release (netrc (4)) to see if we missed something
Also, you've defined the macro "backup". Where did you ever call it?
Connected to myserver1
220 myserver1 FTP server (Version 4.2 Fri May 2 12:48:10 CDT 2008) ready.
331 Password required for root.
230-Last unsuccessful login: Thu Dec 09 21:16:11 NFT 2010 on ftp from myserver2
230-Last login: Fri Sep 30 12:53:58 DFT 2011 on ftp from myserver2
230 User root logged in.
ftp> $ backup
cd /tmp
250 CWD command successful.
pwd
257 "/tmp" is current directory.
prompt
Interactive mode off.
mput *-file.txt
200 PORT command successful.
150 Opening data connection for 1-file.txt.
226 Transfer complete.
28960 bytes sent in 0.001277 seconds (2.215e+04 Kbytes/s)
local: 1-file.txt remote: 1-file.txt
quit
221 Goodbye.
Just curious, but is there any compelling reason not to use scp for this?
Hi i've removed the macro and now this is the new output:
Connected to 192.168.27.147 (192.168.27.147).
220 TYPSoft FTP Server 1.11 ready...
Unknown .netrc keyword put
Unknown .netrc keyword /tmp/elaboralog/20110928-totale.txt
Unknown .netrc keyword quit
331 Password required for nsm_ftp.
230 User nsm_ftp logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
We seem to have a fundamental problem here.
The error messages are "Unknown .netrc keyword".
The sole and only purpose of a the file called ".netrc" is to hold the username and password to access a remote ftp server. One line per server:
e.g.
machine myservername login myaccount password mypassword
The commands to ftp should not be in the ".netrc" file.
The "ftp" will read a correctly formatted ".netrc" file to find out the password (providing that the .netrc file is in the right place and has the right permissions).
If this doesn't crack it, please mention what Operating System (and version) and what Shell you are using.
@scottn
I see what you mean but the ".netrc" quoted is not valid on normal "ftp" because the "machine" line is split into multiple lines. I didn't notice the "macdef" line ... but I now believe it to be surplus.