Use ftp in shell scripts with password in .netrc
ftp can be used in shell scripts by specifying the ftp password in a .netrc file.
On the source server create/edit this file:
$ vi $HOME/.netrc
Add in a line with the username password details:
machine targetservername login targetusername password targetpassword
Make that file secure (the ftp actually fails if you don’t):
$ chmod 600 $HOME/.netrc
Leave a Reply