Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Automate FTP server logins from the Terminal UNIX
You can make file that holds a list of machines and their associated usernames and passwords quite easily. This file is also recognized by wget (a powerful ftp and http client). You need to be in your home directory and type
pico .netrc
This will open a text editor into which you type:
machine machine_name_or_IP# user your_username password  your_password
Then type control-X to save the file and exit from pico.

At the terminal prompt type:
chmod 700 .netrc.
This makes the file readable only by you.

Now when you ftp to that machine you will automatically log in. You can add additional machines one line at a time. If you want, you can make the last line look like this:
default user anonymous password
This will enable anonymous login. Even better is that wget recognizes this file and automatically logs into the machines specified. I got this from the ftp man page ('man ft' in the Terminal), very near the bottom. Enjoy!
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)

Automate FTP server logins from the Terminal | 2 comments | Create New Account
Click here to return to the 'Automate FTP server logins from the Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Possible fix
Authored by: sfederman on Dec 11, '01 12:05:48AM

This is useful. I don't know if I have a different version of ftp than the author of this tip, but I needed to change the command slightly to get it to work:


I needed to change 'user' in the original tip to 'login'.

[ Reply to This | # ]
Possible fix
Authored by: Greg on Dec 13, '01 08:48:25AM

I was the original poster for this hint, and I want to thank sfederman for the correction.

Thanks for such a useful site where we can share these tidbits.

[ Reply to This | # ]