Skip to content

Instantly share code, notes, and snippets.

@dbiesecke
Last active June 20, 2021 09:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dbiesecke/b00eff217ad00069933d to your computer and use it in GitHub Desktop.
Save dbiesecke/b00eff217ad00069933d to your computer and use it in GitHub Desktop.
FUSE Tips & Tricks

Basic

Example invocation using sshfs:

`afuse -o mount_template="sshfs %r:/ %m" \
        -o unmount_template="fusermount -u -z %m" \
           mountpoint/`

Now try ls mountpoint/user@host/.

afuse examples

        afuse -o mount_template="sshfs -o allow_other -o idmap=user %r:/ %m" -o unmount_template="fusermount -u -z %m" ~/sshfs/
        afuse -o mount_template="curlftpfs -o allow_other ftp://%r %m" -o unmount_template="fusermount -u -z %m" /ftpfs/
        afuse -o mount_template="wdfs http://%r %m -o allow_other -o username=user -o password=password" -o unmount_template="fusermount -u -z %m" /davfs/

Auto-Mount (dr)FTP/HTTP/DAV/Whatever Server with LFTPFs

Bsp: Automount drFTPd Site & prepopulate dir's

Example: ls /mnt/iNCOMiNG

Preq: Write your "mount script"

  • ~/lftp/site-incomming

          set ftp:fxp-force no
          set ftp:fxp-passive-source true
          set ftp:use-fxp false
          set ssl:check-hostname no
          set ssl:verify-certificate no
          
          open ftp://USERNAME:PASSWoRD@yoursite.muuu.com:10900/
    
  • Get your preprolutatet dir list like

            echo | lftp -e 'cd iNCOMiNG/;nlist' site-yours > ~/lftp/cat-incoming
    
  • Create cache dir's

          mkdir /mnt/cache && cd !$
          cat ~/lftp/cat-incoming | xargs  mkdir
    
  • Now the afuse magic:

          afuse -o populate_root_command="echo | cat ~/lftp/cat-incoming" \
            -o mount_template="lftpfs --options=allow_other --no-cache=true %m /mnt/cache/%r \
             ~/lftp/site-incomming /iNCOMiNG/%r" -o unmount_template="fusermount -u -z %m" /mnt/iNCOMiNG/%r
    

Basic

Example invocation using sshfs:

`afuse -o mount_template="sshfs %r:/ %m" \
        -o unmount_template="fusermount -u -z %m" \
           mountpoint/`

Now try ls mountpoint/user@host/.

#generatet with:
# # echo | lftp -e 'cd iNCOMiNG/;nlist' site-fontana > ~/lftp/cat-incoming
0DAY-TODAY
MP3-TODAY
CHARTS
TV-DOKU-720P-DE
0DAY
TV-DVDR-DE
TV-720P-DE
GAMES-XBOXONE
FLAC
XViD-DE
XXX-720P
X264-720P-DE
TV-DE
DVDR-DE
MP3
EBOOKS
GAMES-PC
TV-720P-EN
BLURAY
AUDiOBOOKS
TV-DVDRiP-EN
XXX
GAMES-NDS
XViD-EN
MViD
X264-1080P-DE
GAMES-DOX
GAMES-PS4
TV-SPORTS
X264-720P-EN
GAMES-PS3
TV-EN
GAMES-PSP
XXX-PAYSiTE-TODAY
MDVDR
GAMES-XBOX360
TV-DOKU-DE
FLAC-TODAY
XXX-PAYSiTE
APPS
GAMES-Wii
afuse -o mount_template="sshfs -o allow_other -o idmap=user %r:/ %m" -o unmount_template="fusermount -u -z %m" ~/sshfs/
afuse -o mount_template="curlftpfs -o allow_other ftp://%r %m" -o unmount_template="fusermount -u -z %m" /ftpfs/
afuse -o mount_template="wdfs http://%r %m -o allow_other -o username=user -o password=password" -o unmount_template="fusermount -u -z %m" /davfs/
afuse -o mount_template="lftpfs --fs-cache-timeout=3600 %m /tmp/.ssl-ftp-.cache ~/%r" -o unmount_template="fusermount -u -z %m" /ssl-ftp/
####################S99mount####################
#!/bin/sh
case $1 in
start)
curlftpfs -o allow_other ftp://bohal:yeah12ha@ftp.hidrive.strato.com /rmount/foilo-500gb
lftpfs --fs-cache-timeout=3600 -o allow_other /rmount/FTP-Archiv /rmount/.FTP-Archiv.cache ~/.lftp/sc-Archiv-500gb
afuse -o mount_template="sshfs -o allow_other -o idmap=user %r:/ %m" -o unmount_template="fusermount -u -z %m" /sshfs/
afuse -o mount_template="curlftpfs -o allow_other ftp://%r %m" -o unmount_template="fusermount -u -z %m" /ftpfs/
;;
stop)
fusermount -z -u /rmount/foilo-500gb
fusermount -z -u /rmount/FTP-Archiv
fusermount -z -u /ftpfs
fusermount -z -u /sshfs
fusermount -z -u /davfs
fusermount -z -u /hidrive
;;
*)
echo "Usage: $0 [start|stop]"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment