Mounting SFTP and FTP shares
This article deals with Filesystem in USErspace (FUSE) and (CurlFtpFS). The first enables the user to mount all kinds of filesystems (including SSH and FTP) at a local mountpoint. CurlFtpFS is a filesystem for acessing FTP hosts based on FUSE and libcurl.
Contents |
[edit] Installing and using FUSE
Make sure you have Filesystem in Userspace support enabled in your kernel:
| Linux Kernel Configuration: I was using 2.6.26-gentoo-r3 |
File systems --->
<M> Filesystem in Userspace support
|
Both, sshfs and CurlFTPFS, have FUSE as dependency. It is easy in installation. Simply:
Then:
and make sure fuse is in modules.autoload:
[edit]
To mount a remote host's file system through SSH at a local mount point, all you have to do is type:
To allow access to mountpoint for non-root users simply execute:
To unmount a remote host's file system type:
[edit]
Installing CurlFtpFS:
CurlFtpFS uses typical FTP syntax:
To unmount an ftp host:
A better way is use mount and umount. To do this the following lines need to be added to /etc/fstab:
curlftpfs#user:password@server.tld/remote/path /mount/point fuse user,disable_eprt,noauto curlftpfs#user:password@server.tld/remote/path /mount/point fuse.curlftpfs user,disable_eprt,noauto
The first line allows mount to work, the second umount to work. Additional options are:
User and password : ftp://user:password@ftp.gentoo.org/
Specific port : ftp://ftp.gentoo.org:8585
Now, you should be able to:
and
[edit] Automounting
Automounting is an even better method. The following is a setup for automounting removable media on an Xterminal. On the terminal
/home/ftp/auto /etc/autofs/auto.misc --timeout=1 --ghost
cdrom -fstype=iso9660,ro :/dev/sr0 floppy -fstype=auto :/dev/fd0 usb-storage -fstype=auto,umask=000 :/dev/sda1
So, it sets up the automounts in FTP's home. Establish FTP and test the automounting by FTPing to the Xterminal's FTP server.
On the application server
/mnt/removables /etc/autofs/auto.misc --timeout=2 --ghost
usb-storage -fstype=curl,allow_other :ftp\://anonymous\:PASSWORD\@mr-muddle/usb-storage floppy -fstype=curl,allow_other :ftp\://anonymous\:PASSWORD\@mr-muddle/floppy cdrom -fstype=curl,allow_other :ftp\://anonymous\:PASSWORD\@mr-muddle/cdrom images -fstype=curl,proxy=http\://192.168.1.1\:3128 :ftp.vwx.yz/images
Automount won't understand fstype=curl without the following files:
#! /bin/sh curlftpfs $1 $2 -o allow_other,disable_eprt $3
#! /bin/sh fusermount -u $1