16.3 FTP Configuration with Net::NetrcUnix-based FTP clients use a file called .netrc , which you can configure to automate FTP access to sites you frequently visit. With a properly defined .netrc file, you can simply execute the FTP command to a favorite FTP host and be automatically logged in to the FTP server. Your .netrc file contains one line for each connection you want to be able to make. The following tokens can be specified for each entry:
Here's an example of a typical .netrc entry: Entering your username and password for remote sites in unencrypted form has serious security implications. Many sites consider .netrc files a violation of security policy and do not allow them. In addition, most FTP clients require that the .netrc file be owned by you and readable only by you, with permissions set to 0400 or 0600. If the permissions aren't correctly set, the autologin process aborts. Net::Netrc follows this security convention - if the permissions and ownership are not correct, the .netrc file isn't read, and a warning message is issued.machine remotehost.com login username password userpasswd Net::Netrc implements a simple interface to the .netrc file, telling you which hosts you can automatically connect to. It doesn't actually connect to any remote hosts; it's simply used to query your configuration file and return the value of the tokens. The following methods are supplied by Net::Netrc: |
|