20080509

automounting ftpfs using curlftpfs and autofs

Software requirements:
  1. working autofs instalation
  2. fuse
  3. curlftpfs
Procedure:
  1. create /sbin/mount.curl containing:
    #!/bin/bash
    curlftpfs $1 $2 -o allow_other,disable_eprt


  2. create /sbin/umount.curl containing:
    #!/bin/bash
    fusermount -u $1


  3. make both created *.curl files executable


  4. add /mnt/ftp /etc/autofs/auto.ftp --ghost
    to /etc/autofs/auto.master

  5. create /etc/autofs/auto.ftp file containing:

    myFTP -fstype=curl,allow_other :ftp\://USER\:PASSWORD\@MACHINE/




Et voila!
cd /mnt/ftp/myFTP; ls

4 comments:

Fog_Watch said...

Before I get to the automounting part I thought I would get manual mounting working. mount works successfully as does fusermount -u /mnt/usb, but umount:
$ umount /mnt/usb
umount: /mnt/usb mount disagrees with the fstab


This is mentioned a few places around the traps, but I haven't seen a solution.

Thoughts?

Regards

Fog_Watch.

Kernel: 2.6.26-gentoo-r3
curlftpfs-0.9.1

Anonymous said...

Too much a work, you can do the same thing easier.
I've got following /etc/auto.ftp:

#!/bin/sh
key="$1"
opts="-fstype=fuse,rw,nodev,nosuid,nonempty,noatime,allow_other"
proto="curlftpfs"
echo "$opts" ":$proto\\#$key"

Don't forget to chmod a+x /etc/auto.ftp.
Now I have line in my /etc/auto.master:
/remote/ftp /etc/auto.ftp uid=1001,gid=1001,--timeout=30,--ghost

And at least I put .netrc with hosts/usernames/passwords into ~root.

So I can cd into /remote/ftp/some.host.name and this host is automagically mounted via curlftpfs. No need for wrapper scripts around curlftpfs!

Jawad said...

I tried with both methods but no luck. Can you tell me how should I debug this.

Unknown said...

Can do even better (without script)
In /etc/auto.ftp (or /etc/autofs/auto.ftp):

myFTP -fstype=fuse curlftpfs#USER\:PASSWORD\@MACHINE