lftp icon indicating copy to clipboard operation
lftp copied to clipboard

Enhancement Request - Add option to specify .netrc location

Open SenseiC opened this issue 3 years ago • 0 comments

If you have large numbers of FTP drop boxes you have to interact with (unique data location for every customer case), having the ability to pass the location of the .netrc file would make life much easier. From the lftp file netrc.cc beginning at line 43:

`NetRC::Entry *NetRC::LookupHost(const char *h,const char *u)
{
   char str[256];
   char chost[256]="";
   char cuser[256]="";
   char cpass[256]="";
   char cacct[256]="";

   const char *const home=getenv("HOME");
   if(!home)
      return 0;

   const char *const netrc=xstring::cat(home,"/.netrc",NULL);
   FILE *f=fopen(netrc,"r");`

Therefore lftp only looks in the user's "home" directory (if it exists) for a .netrc file.

For example this option exists in Curl. From the Curl man page:

   --netrc-file <filename>
          This option is similar to -n, --netrc, except that you
          provide the path (absolute or relative) to the netrc file
          that curl should use.  You can only specify one netrc file
          per invocation. If several --netrc-file options are
          provided, the last one will be used.

          It will abide by --netrc-optional if specified.

          This option overrides -n, --netrc. Added in 7.21.5.

SenseiC avatar Sep 27 '21 13:09 SenseiC