I wanted to use curlftpfs together with autofs on a multi-user system. Everything worked fine out of the box except for the fact that the user's .netrc is read. Since autofs doesn't mount the file systems as the given user, obviously, it cannot find the user's .netrc file.

So here's a patch to give the location of the netrc file via an option. In a program map for autofs, the filesystem option netrc=\$HOME/.netrc can then be given, to find the netrc of the user requesting the mount.

diff -crB curlftpfs-0.9.2-orig/ftpfs.c curlftpfs-0.9.2-mod/ftpfs.c
*** curlftpfs-0.9.2-orig/ftpfs.c    Wed Apr 30 01:05:47 2008
--- curlftpfs-0.9.2-mod/ftpfs.c Fri Jan 21 12:32:11 2011
***************
*** 174,179 ****
--- 174,180 ----
    FTPFS_OPT("codepage=%s",        codepage, 0),
    FTPFS_OPT("iocharset=%s",       iocharset, 0),
    FTPFS_OPT("nomulticonn",        multiconn, 0),
+   FTPFS_OPT("netrc=%s",           netrc, 0),
  
    FUSE_OPT_KEY("-h",             KEY_HELP),
    FUSE_OPT_KEY("--help",         KEY_HELP),
***************
*** 1494,1499 ****
--- 1495,1501 ----
  "    utf8                try to transfer file list with utf-8 encoding\n"
  "    codepage=STR        set the codepage the server uses\n"
  "    iocharset=STR       set the charset used by the client\n"
+ "    netrc=STR           file to use instead of the default .netrc file\n"
  "\n"
  "CurlFtpFS cache options:  \n"
  "    cache=yes|no              enable/disable cache (default: yes)\n"
***************
*** 1764,1769 ****
--- 1766,1774 ----
      exit(1);
    }
  
+   if (ftpfs.netrc)
+     curl_easy_setopt_or_die(easy, CURLOPT_NETRC_FILE, ftpfs.netrc);
+ 
    res = cache_parse_options(&args);
    if (res == -1)
      exit(1);
diff -crB curlftpfs-0.9.2-orig/ftpfs.h curlftpfs-0.9.2-mod/ftpfs.h
*** curlftpfs-0.9.2-orig/ftpfs.h    Fri Apr 25 12:32:30 2008
--- curlftpfs-0.9.2-mod/ftpfs.h Fri Jan 21 12:01:46 2011
***************
*** 67,72 ****
--- 67,73 ----
    char *codepage;
    char *iocharset;
    int multiconn;
+   char *netrc;
  };
  
  extern struct ftpfs ftpfs;