takecare.ro

Mounting FTP Hosts as Local Filesystem

by on Jan.17, 2010, under Uncategorized

Those from Windows background know the ease of accessing remote FTP hosts as local file system but do you know how easily it could be done even in Linu! If not, read on. We’ll be using a small command line tool called CurlFtpFS to mount remote FTP hosts, as Linux does not natively supports FTP file systems.

Downloading and Installing CurlFtpFS


If you want you can install the binary version of CurlFtpFS using your package manager. We’re not going to go into any detail as different distros have different ways of doing this, refer to your distros software installing instructions. Also, not every distro might be having CurlFtpFS on their pacakge repository. Instead it’ll be better to lay down the instructions for installing this from source.

You can download CurlFtpFS from CurlFtpFS’s SourceForge Page. After downloading unpack it to some directory, open a terminal, browse to the location you have unpacked it and give the following command:

./configure

On successful configure(ation), you’ll see something like the following towards the end of the long scrolling text or some error message in case something goes wrong.

configure: creating ./config.status
config.status: creating Makefile
config.status: creating compat/Makefile
config.status: creating tests/Makefile
config.status: creating doc/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands

If nay error message is shown that means you don’t have all the dependencies that CurlFtpFS requires, so first try installing them (which may get quite tedious) or go for the binary package.

Now neter the following commands as root:

make

and then:

make install

If everything goes fine, you’ll have the tool installed on your system, to make sure enter the following andd press enter:

curlftpfs –version

Which will output the version information:

curlftpfs 0.9.2 libcurl/7.19.2 fuse/2.7

This means CurlFtpFS is installed correctly.

Mounting a Remote FTP Host

After installion, mounting is a breeze. First create a mount point  oof any name inside /mnt or /media (whichever you have) (we’ve created /mnt/FTP), refer to  Accessing (Mounting) Windows (NTFS/FAT) Partitions Under Linux. Now enter the following in terminal as root:

curlftpfs ftp://username:[email protected] /mnt/FTP

Here,

  1. curlftpfs – the tool
  2. username – username for the FTP host
  3. password – the password
  4. ftp.example.com – the FTP host
  5. /mnt/FTP – mount point

FTP hosts can be mounted anonymously using the following command:

curlftpfs ftp://ftp.example.com /mnt/FTP

After successful mounting, the remote host will be accessible like any other directory, you can use your terminal or file manager to browse and do whatever you want.

Just to make sure everything went fine browse to the mounted directory and use the ls command:

cd /mnt/FTP
ls

Which will output the directory listing, mine looked like the following:

access-logs           cpmove.psql  mail    public_html  tmp
cpbackup-exclude.conf  etc        public_ftp    ssl         www

You can also use your file manager (as root):

Filemanager used to browse mounted FTP host

Fig.: Filemanager used to browse mounted FTP host

 

Unmounting

After having done, you can unmount the FTP host using the following command (as root):

umount /mnt/FTP

Again, here /mnt/FTP is the mount point we had mounted the FTP host on.

Remember, the unmounting part is same as that for other filesytems (refer to  Accessing (Mounting) Windows (NTFS/FAT) Partitions Under Linux), it’s just the mounting part that is different.

If you encounter the following error during the mounting the ftp resource:
fusermount: failed to open /dev/fuse: No such file or directory
you need to check if the make sure that the fuse module is loaded:

# modprobe fuse

As usual we need to install the software:

apt-get install encfs

(If we already have the fuse module installed, then the only dependency will be librlog1).


Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...