Mounting SFTP and FTP shares
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Contents |
[edit] Introduction
This HOWTO article deals with Filesystem in USErspace (FUSE), Linux Userland File System (LUFS) and (CurlFtpFS). The first two are libraries aimed at enabling 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. At the time of writing, LUFS is no longer in active development (last publicized version is from 2003) while FUSE seems to become more and more mainstream, staying in active development. Therefore I suggest using either FUSE or CurlFtpFS to ensure bug and performance fixes.
[edit] Installing and using FUSE
FUSE allows you to mount a variety of filesystems.
[edit] Prerequisites
You have to have File systems->Filesystem in Userspace support enabled in your kernel configuration in order to use FUSE (FUSE_FS=m or FUSE_FS=y). Otherwise you'll get compile error in the next step.
Both, sshfs and CurlFTPFS, have FUSE as dependency. It is easy in installation. Simply execute:
# emerge sys-fs/fuse
Then load the fuse module (as root):
# modprobe fuse
[edit] Mounting SFTP shares
Unfortunately, currently only the sshfs module is available through portage, so we'll use that as an example:
# emerge sys-fs/sshfs-fuse
To mount a remote host's file system through SSH at a local mount point, all you have to do is type:
# sshfs [user@]host:[dir] mountpoint
To allow access to mountpoint for non-root users simply execute:
# sshfs [user@]host:[dir] mountpoint -o allow_other
To unmount a remote host's file system type:
# fusermount -u mountpoint
You can also use umount to unmount. Note: It requires root rights:
# umount mountpoint
For more information, see:
[edit] Mounting FTP shares
[edit] Installing and using CurlFtpFS
Installing CurlFtpFS from portage:
# emerge -av net-fs/curlftpfs
Whenever I try to create a directory I get the following error and the program crashes.
mkdir: cannot create directory `tst': Software caused connection abort
Solution: I also had this problem (along with a transport connection error). To fix it, I upgraded my curl to 7.18.1 and my kernel (with FUSE enabled) to v2.6.24-r8.
CurlFtpFS uses typical FTP syntax:
# curlftpfs ftp://ftp.gentoo.org/ /path/to/mountpoint
To unmount an ftp host:
# fusermount -u /path/to/mountpoint/
/etc/fstab line:
curlftpfs#user:password@server.tld/remote/path /mount/point fuse user,disable_eprt,noauto
[edit] More Information on CurlFtpFS
Additional options:
- User and password : ftp://user:password@ftp.gentoo.org/
- Specific port : ftp://ftp.gentoo.org:8585
For more information, see the man page:
# man curlftpfs
[edit] Installing and using LUFS
If LUFS tries to get the remote /etc/password file, don't worry - that's normal, it's done by the load_credentials() function.
Installing LUFS from portage:
# emerge sys-fs/lufs
To mount an ftp host:
# lufis fs=ftpfs,host=ftp.kernel.org /mnt/lufis/ -s
To Unmount an ftp host:
# fusermount -u /mnt/lufis
[edit] More Information on LUFS
Specific mount options:
- host=server : the ftp server to mount
- port=port : the port the ftp server is listening on
- username=user : the user to authenticate on the server
- password=pass : the user's password
- ftpactive : will use active data connection (the server initiates the data connection)
instead of passive data connection (the client opens the connection)
For more information, see the man page:
# man lufs
