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
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>