Real estate is all about location; Macs are all about convenience. It should come as no surprise, then, that you can connect to FTP servers from Terminal just as you can from the Finder or a Web browser. And with a little side help from Terminal’s FTP program, which lets you download some very cool automation features, you can save oodles of time in the process.
Automating FTP Server Logins
When you use the ftp program to connect to servers, you must either include your user name and password in the command line or enter them when prompted by ftp. With help from a file named .netrc, however, you can make this process much simpler.
Make sure you’re in your Home directory by typing cd ~, then type pico .netrc (use a different editor, if you prefer). For each FTP host that you connect to, add a line in the .netrc file that matches this syntax:
machine machine_name login user_name password your_password
For example, if you regularly connect to ftp.myfavoritestuff.com with the user name Wilson and the password beachplay, the .netrc entry would look like this:
machine ftp.myfavorites.com login Wilson password beachplay
Add a new row for every machine you regularly connect to, and then save the file and quit the editor.
Before you use this file with ftp, confirm that none of the other accounts on the machine can read it. Use the command chmod 700 .netrc to restrict the visibility of the file to just your account, so no one else can access your user name and password.
Now, type ...